Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
KittenService: Formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
javajawa committed Dec 24, 2013
1 parent b4ce516 commit 48e6b0a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/uk/co/harcourtprogramming/docitten/KittenService.java
Expand Up @@ -87,14 +87,20 @@ public void handle(Message m)
String chan = m.getChannel();

if ("me".equals(nick))
{
nick = m.getSender();
}

if (chan == null)
{
if (token.consume("in"))
{
m.act(token.nextToken(' '), play(nick));
}
else
{
m.act(nick, play(nick));
}
}
else
{
Expand All @@ -107,23 +113,31 @@ public void handle(Message m)
{
Matcher attentionMatcher = attention.matcher(mess);
if (attentionMatcher.find())
{
m.act(attend(m.getSender()));
}
}

// Stop DoCitten replying to itself as much
if (mess.equals("mew =^.^="))
{
return;
}

StringBuilder reply = new StringBuilder(100);

// Find things we need to mewl at
Matcher kittenMatcher = kitten.matcher(mess);
while (kittenMatcher.find())
{
reply.append(mewl()).append(' ');
}

Matcher mewlsMatcher = mewls.matcher(mess);
while (mewlsMatcher.find())
{
reply.append(mewl()).append(' ');
}

if (reply.length() != 0)
{
Expand Down Expand Up @@ -160,7 +174,10 @@ private String mewl()
private String attend(String user)
{
if (user == null)
{
user = "nice people";
}

switch (r.nextInt(9))
{
case 0: return "purrs";
Expand Down

0 comments on commit 48e6b0a

Please sign in to comment.