Some updates

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

2
.gitignore vendored

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

@ -137,16 +137,21 @@ class Chatter:
else:
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
for on_message recognition of @bot
"""
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:
to_strip = "@" + author.guild.me.display_name + " "
if author.id != self.bot.user.id:
to_strip = "@" + guild.me.display_name + " "
text = message.clean_content
if not text.startswith(to_strip):
return

Loading…
Cancel
Save