Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed a bug where rawrbot would respond to greetings/farewells includ…

…ing its name but not exactly its name.
  • Loading branch information...
commit 341663d17ed3a8a705fa07d8f22cd37116817dcc 1 parent ef9eeec
Craig Meinschein authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 plugins/plugin_social.rb
6 plugins/plugin_social.rb
View
@@ -19,7 +19,7 @@ class Social
# Description:
# Say hi!
def greet(m)
- if m.message.match(/(hellos?|hi(ya)?|howdy|hey|greetings|yo|sup|hai|hola),? #{m.bot.nick}/i)
+ if m.message.match(/\b(hellos?|hi(ya)?|howdy|hey|greetings|yo|sup|hai|hola),? #{m.bot.nick}\b/i)
greetings = ['Hello','Hi','Hola','Ni hao','Hey','Yo','Howdy']
greeting = greetings[rand(greetings.size)]
m.reply "#{greeting}, #{m.user.nick}!"
@@ -31,7 +31,7 @@ def greet(m)
# Description:
# Gives a time of day-specific response to a greeting. i.e. 'good morning'.
def timeofday_greet(m)
- if m.message.match(/(good)? ?(morning|afternoon|evening|night),? #{m.bot.nick}/i)
+ if m.message.match(/\b(good)? ?(morning|afternoon|evening|night),? #{m.bot.nick}\b/i)
m.reply "Good #{$2.downcase}, #{m.user.nick}!"
end
end # End of timeofday_greet function
@@ -43,7 +43,7 @@ def timeofday_greet(m)
def farewell(m)
farewells = ['Bye','Adios','Farewell','Later','See ya','See you','Take care']
farewell = farewells[rand(farewells.size)]
- if m.message.match(/((good)?bye|adios|farewell|later|see ?(ya|you|u)|cya),? #{m.bot.nick}/i)
+ if m.message.match(/\b((good)?bye|adios|farewell|later|see ?(ya|you|u)|cya),? #{m.bot.nick}\b/i)
m.reply "#{farewell}, #{m.user.nick}!"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.