Cleanup chatterbot.py

This commit is contained in:
aikaterna
2017-04-07 21:57:28 -07:00
parent 71a2017c20
commit e4a3d205f7

View File

@@ -1,4 +1,3 @@
import discord
from discord.ext import commands
try:
from chatterbot import ChatBot
@@ -6,12 +5,13 @@ try:
except:
chatbotInstalled = False
class Chatterbot:
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."""
@@ -19,9 +19,10 @@ class Chatterbot:
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))
bot.add_cog(ChatterBot(bot))