Cleanup chatterbot.py
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user