diff --git a/README.md b/README.md index 9a7a0ae..7246331 100644 --- a/README.md +++ b/README.md @@ -3,4 +3,6 @@ Cogs for Red-DiscordBot by Twentysix26. cah - Cards Against Humanity. A port of CorpBot's module: https://github.com/corpnewt/CorpBot.py +chatterbot - A cog to chat with the bot, using ChatterBot: https://github.com/gunthercox/ChatterBot + pug - Warcraft pug checker. A port of PugBot's module: https://github.com/reznok/PugBot diff --git a/chatterbot/chatterbot.py b/chatterbot/chatterbot.py new file mode 100644 index 0000000..79be495 --- /dev/null +++ b/chatterbot/chatterbot.py @@ -0,0 +1,27 @@ +import discord +from discord.ext import commands +try: + from chatterbot import ChatBot + chatbotInstalled = True +except: + chatbotInstalled = False + +class Chatterbot: + """Chatter with the bot.""" + + def __init__(self, bot): + self.bot = bot + + @commands.command(pass_context=True) + async def chatterbot(self, ctx, message): + """Talk with the bot via ChatterBot.""" + chatbot = ChatBot('Red-DiscordBot', trainer='chatterbot.trainers.ChatterBotCorpusTrainer') + chatbot.train("chatterbot.corpus.english") + await self.bot.say(chatbot.get_response(message)) + +def setup(bot): + if chatbotInstalled is False: + raise RuntimeError("Install ChatterBot:\n" + "[p]debug bot.pip_install('ChatterBot')\n" + "Then [p]load chatterbot") + bot.add_cog(Chatterbot(bot)) diff --git a/chatterbot/info.json b/chatterbot/info.json new file mode 100644 index 0000000..587367e --- /dev/null +++ b/chatterbot/info.json @@ -0,0 +1,9 @@ +{ + "AUTHOR" : "aikaterna", + "INSTALL_MSG" : "Thanks for installing ChatterBot. This is still in testing.", + "NAME" : "Chatterbot", + "SHORT" : "Chat with the bot.", + "REQUIREMENTS" : ["ChatterBot"], + "DESCRIPTION" : "ChatterBot is a machine-learning based conversational dialog engine, check it out at: https://github.com/gunthercox/ChatterBot", + "TAGS" : ["chatter", "chat"] +} diff --git a/pug/info.json b/pug/info.json index cdc52cb..562239b 100644 --- a/pug/info.json +++ b/pug/info.json @@ -4,5 +4,5 @@ "NAME" : "Pug", "SHORT" : "Warcraft character lookup.", "DESCRIPTION" : "This tool lets you check potential group pugs for enchants, gems, and raid completion. It was made possible by PugBot: https://github.com/reznok/PugBot", - "TAGS" : ["warcraft", "raiding"] + "TAGS" : ["warcraft", "raiding", "raid"] }