Some updates

pull/15/head
bobloy 7 years ago
parent 3e4730a497
commit 67c4975343

2
.gitignore vendored

@ -1,3 +1,5 @@
.idea/ .idea/
*.pyc *.pyc
venv/ venv/
v-data/
database.sqlite3

@ -137,16 +137,21 @@ class Chatter:
else: else:
await ctx.send("Error occurred :(") await ctx.send("Error occurred :(")
async def on_message(self, message): async def on_message(self, message: discord.Message):
""" """
Credit to https://github.com/Twentysix26/26-Cogs/blob/master/cleverbot/cleverbot.py Credit to https://github.com/Twentysix26/26-Cogs/blob/master/cleverbot/cleverbot.py
for on_message recognition of @bot for on_message recognition of @bot
""" """
author = message.author author = message.author
channel = message.channel try:
guild: discord.Guild = message.guild
except AttributeError: # Not a guild message
return
channel: discord.TextChannel = message.channel
if message.author.id != self.bot.user.id: if author.id != self.bot.user.id:
to_strip = "@" + author.guild.me.display_name + " " to_strip = "@" + guild.me.display_name + " "
text = message.clean_content text = message.clean_content
if not text.startswith(to_strip): if not text.startswith(to_strip):
return return

Loading…
Cancel
Save