From 056a290f8096522f6a30221c27336e6c4a5e1f71 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 8 May 2019 13:07:36 -0400 Subject: [PATCH] Adjust AI --- sopel_modules/SpiceBot_AI/AI.py | 47 +++++++++++++++++-- .../SpiceBot_FriendlyBot/FriendlyBot.py | 14 ------ .../SpiceBot_FriendlyBot/__init__.py | 8 ---- .../SpiceBot_InsultHandler/InsultHandler.py | 15 ------ .../SpiceBot_InsultHandler/__init__.py | 8 ---- 5 files changed, 42 insertions(+), 50 deletions(-) delete mode 100644 sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py delete mode 100644 sopel_modules/SpiceBot_FriendlyBot/__init__.py delete mode 100644 sopel_modules/SpiceBot_InsultHandler/InsultHandler.py delete mode 100644 sopel_modules/SpiceBot_InsultHandler/__init__.py diff --git a/sopel_modules/SpiceBot_AI/AI.py b/sopel_modules/SpiceBot_AI/AI.py index 0791744..0f1cd34 100644 --- a/sopel_modules/SpiceBot_AI/AI.py +++ b/sopel_modules/SpiceBot_AI/AI.py @@ -10,18 +10,52 @@ from sopel_modules.SpiceBot_SBTools import sopel_triggerargs, googlesearch, bot_ from sopel_modules.SpiceBot_Events.System import bot_events_check +@sopel.module.rule(r'(?i)(hi|hello|hey),? $nickname[ \t]*$') +def bot_command_hello(bot, trigger): + hello = spicemanip.main(['Hi', 'Hey', 'Hello'], "random") + punctuation = spicemanip.main(['', '!', '?'], "random") + bot.osd(hello + ' ' + trigger.nick + punctuation) + + +@sopel.module.nickname_commands('hello') +def bot_command_hello_b(bot, trigger): + bot_command_hello(bot, trigger) + + +@sopel.module.rule('$nickname!') +def exclaim(bot, trigger): + bot.say(trigger.nick + '!') + + +@sopel.module.rule('$nickname?') +def imhere(bot, trigger): + bot.say("I'm here, " + trigger.nick) + + +@sopel.module.rule(r'(?i)(Fuck|Screw) (you|off),? $nickname[ \t]*$') +def bot_command_srewyou(bot, trigger): + bot.osd("Watch your mouth, " + trigger.nick + ", or I'll tell your mother!") + + +@sopel.module.rule(r'(?i)(Damnit|Lazy)? $nickname[ \t]*$') +def bot_command_damnlazy(bot, trigger): + bot.osd("I do not tell you how to do your job, " + trigger.nick + "!!!") + + +@sopel.module.rule('$nickname is lazy') +def bot_command_damnlazy_b(bot, trigger): + bot_command_damnlazy(bot, trigger) + + @sopel.module.nickname_commands('(.*)') -def bot_command_gender(bot, trigger): +def bot_command_nick(bot, trigger): while not bot_events_check(bot, ['1004', '2002']): pass triggerargs, triggercommand = sopel_triggerargs(bot, trigger, 'nickname_command') - if not triggercommand: - bot.bot.osd("I don't know what you are asking me to do!") - return - if str(bot.nick) + " " + triggercommand in bot.memory['SpiceBot_CommandsQuery']['commands']["nickname"].keys(): + if not triggercommand or triggercommand in bot.memory['SpiceBot_CommandsQuery']['commands']["nickname"].keys(): return specialcomposs = spicemanip.main(triggerargs, 0).lower() @@ -59,6 +93,9 @@ def bot_command_gender(bot, trigger): bot.osd("Not sure what you want me to look for.") return + # if specialcomposs.lower().startswith("what time is it"): + # TODO + # elif specialcomposs.lower().startswith(tuple(["have you seen"])): # posstarget = spicemanip.main(triggerargs, 4) or 0 # message = seen_search(bot, botcom, posstarget) diff --git a/sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py b/sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py deleted file mode 100644 index 5d139bd..0000000 --- a/sopel_modules/SpiceBot_FriendlyBot/FriendlyBot.py +++ /dev/null @@ -1,14 +0,0 @@ -# coding=utf-8 - -from __future__ import unicode_literals, absolute_import, division, print_function - -import sopel.module - -import spicemanip - - -@sopel.module.rule(r'(?i)(hi|hello|hey),? $nickname[ \t]*$') -def bot_command_hello(bot, trigger): - hello = spicemanip.main(['Hi', 'Hey', 'Hello'], "random") - punctuation = spicemanip.main(['', '!', '?'], "random") - bot.osd(hello + ' ' + trigger.nick + punctuation) diff --git a/sopel_modules/SpiceBot_FriendlyBot/__init__.py b/sopel_modules/SpiceBot_FriendlyBot/__init__.py deleted file mode 100644 index 5f142f9..0000000 --- a/sopel_modules/SpiceBot_FriendlyBot/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# coding=utf8 -from __future__ import unicode_literals, absolute_import, division, print_function - -from .FriendlyBot import * - -__author__ = 'Sam Zick' -__email__ = 'sam@deathbybandaid.net' -__version__ = '0.1.1' diff --git a/sopel_modules/SpiceBot_InsultHandler/InsultHandler.py b/sopel_modules/SpiceBot_InsultHandler/InsultHandler.py deleted file mode 100644 index 19c1c69..0000000 --- a/sopel_modules/SpiceBot_InsultHandler/InsultHandler.py +++ /dev/null @@ -1,15 +0,0 @@ -# coding=utf-8 - -from __future__ import unicode_literals, absolute_import, division, print_function - -import sopel.module - - -@sopel.module.rule(r'(?i)(Fuck|Screw) (you|off),? $nickname[ \t]*$') -def bot_command_srewyou(bot, trigger): - bot.osd("Watch your mouth, " + trigger.nick + ", or I'll tell your mother!") - - -@sopel.module.rule(r'(?i)(Damnit|Lazy)? $nickname[ \t]*$') -def bot_command_damnlazy(bot, trigger): - bot.osd("I do not tell you how to do your job, " + trigger.nick + "!!!") diff --git a/sopel_modules/SpiceBot_InsultHandler/__init__.py b/sopel_modules/SpiceBot_InsultHandler/__init__.py deleted file mode 100644 index 6f1bdc3..0000000 --- a/sopel_modules/SpiceBot_InsultHandler/__init__.py +++ /dev/null @@ -1,8 +0,0 @@ -# coding=utf8 -from __future__ import unicode_literals, absolute_import, division, print_function - -from .InsultHandler import * - -__author__ = 'Sam Zick' -__email__ = 'sam@deathbybandaid.net' -__version__ = '0.1.1'