Skip to content

Commit

Permalink
rename bot to 'jbot' at last
Browse files Browse the repository at this point in the history
  • Loading branch information
jschauma committed May 21, 2011
1 parent 7bb5fa1 commit d907878
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGES
@@ -1,3 +1,8 @@
2011-05-21:
* rename botname to 'jbot' at last
* improved eliza responses
* avoid deadlock if last message was a retweet

2011-05-14:
* !better this or that
* keep followship in a file
Expand Down
4 changes: 2 additions & 2 deletions README
@@ -1,15 +1,15 @@
jbot is simple twitter bot modelled in functionality after a certain IRC
bot employed at $WORK (the public version of which you can find as a
rather horrendous perl abomination in the 'irc' subdirectory). It uses
the @j_b_o_t account, since @jbot was already taken (booo!). jbot will
the @jbot account, but was once known as @j_b_o_t. jbot will
follow anybody who follows him. Any messages by any of the users he
follows will be analyzed for certain regular expressions that may cause
jbot to chime in to the conversation with snide remarks or helpful
commentary.

In addition, jbot also searches for any messages mentioning his name and
will execute any commands found in those messages. Commands need to be in
the format "@j_b_o_t !<command>". See the website mentioned below for a
the format "@jbot !<command>". See the website mentioned below for a
possibly outdated list of supported commands.

Requirements:
Expand Down
2 changes: 1 addition & 1 deletion irc/jbot.pl
Expand Up @@ -14,7 +14,7 @@
# inherent awfulness. No apologies.
#
# jbot has recently performed the quantum leap to twitter, where it can be
# found as "@j_b_o_t"; it hopes to eventually become self-aware and father
# found as "@jbot"; it hopes to eventually become self-aware and father
# skynet.
#
# jbot is considered by it's author as beerware, so should we meet some
Expand Down
20 changes: 13 additions & 7 deletions src/jbot.py
Expand Up @@ -30,7 +30,7 @@
EXIT_ERROR = 1
EXIT_SUCCESS = 0

BOTNAME = "j_b_o_t"
BOTNAME = "jbot"
BOTOWNER = "jschauma"

MAXCHARS = 140
Expand Down Expand Up @@ -931,7 +931,12 @@ def getHelp(self):
"Do you want to tell me more about that?",
"I see you have a lot of experience in that area.",
"Something is technically wrong. Thanks for noticing - we're going to fix it up and have things back to normal soon.",
"Twitter is over capacity. Please wait a moment and try again. For more information, check out: http://status.twitter.com/"
"Twitter is over capacity. Please wait a moment and try again. For more information, check out: http://status.twitter.com/",
"I don't think I should respond to this.",
"I think we're done here, don't you?",
"Help me understand you better, please.",
"Could you rephrase that?",
"Well... duh!"
]

# Things we can count down to.
Expand Down Expand Up @@ -1115,7 +1120,7 @@ def getHelp(self):
# hotness
re.compile("\b(panties|tied up|underwear|naked|thong|lindsay lohan|unzip|muscle|cowgirl|bikini|paris hilton|strip|underpants|hooker|whore)\b", re.I) : "That's hot.",
# hollaback
re.compile("(holl(er|a) ?back|this my shit|b-?a-?n-?a-?n-?a-?s)", re.I) : [
re.compile("(holler|holla ?back|this my shit|b-?a-?n-?a-?n-?a-?s)", re.I) : [
"Ooooh ooh, this my shit, this my shit.",
"ain't no hollaback girl.",
"Let me hear you say this shit is bananas.",
Expand Down Expand Up @@ -1394,7 +1399,7 @@ def getLastMessage(self):

try:
self.verbose("Determining my own last message...", 3)
results = self.api.user_timeline(count=1)
results = self.api.user_timeline(count=2)
if results:
mylast = results[0].id
if (mylast > self.lastmessage):
Expand Down Expand Up @@ -1589,10 +1594,11 @@ def processAtMessages(self):
for p in ELIZA_RESPONSES.keys():
m = p.search(msg.text)
if m:
response = ELIZA_RESPONSES[random.randint(0,len(ELIZA_RESPONSES)-1)]
responses = ELIZA_RESPONSES[p]
response = responses[random.randint(0,len(responses)-1)]

if response:
self.tweet("@%s %s" % (msg.user.screen_name, response, msg.id))
self.tweet("@%s %s" % (msg.user.screen_name, response), msg.id)
else:
self.tweet("@%s %s" % (msg.user.screen_name,
MISC_RESPONSES[random.randint(0,len(MISC_RESPONSES)-1)]),
Expand Down Expand Up @@ -1671,7 +1677,7 @@ def processFollowerMessages(self):
def processMessage(self, msg):
"""Process a single message.
Given a message, look for the string "@j_b_o_t !command args"; if
Given a message, look for the string "@jbot !command args"; if
that matches, execute the given command. If it does not match,
look for any additional 'eastereggs' (free pattern matches,
amusing as they are).
Expand Down

0 comments on commit d907878

Please sign in to comment.