Some updates

This commit is contained in:
bobloy 2018-08-23 17:03:02 -04:00
parent 3e4730a497
commit 67c4975343
2 changed files with 11 additions and 4 deletions

2
.gitignore vendored
View File

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

View File

@ -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
if message.author.id != self.bot.user.id:
to_strip = "@" + author.guild.me.display_name + " "
channel: discord.TextChannel = message.channel
if author.id != self.bot.user.id:
to_strip = "@" + guild.me.display_name + " "
text = message.clean_content
if not text.startswith(to_strip):
return