1
0
Fork 0
mirror of synced 2024-06-21 12:00:16 +12:00

Made sure that tags cannot be created that mention everyone

This commit is contained in:
Phxntxm 2016-12-12 09:52:04 -06:00
parent 027b0a18be
commit 7f0fec170f

View file

@ -59,11 +59,16 @@ class Tags:
await self.bot.say(
"Please provide the format for the tag in: {}tag add <tag> - <result>".format(ctx.prefix))
return
# If our regex failed to find the content (aka they provided the wrong format)
if len(tag) == 0 or len(tag_result) == 0:
await self.bot.say(
"Please provide the format for the tag in: {}tag add <tag> - <result>".format(ctx.prefix))
return
# Make sure the tag created does not mention everyone/here
if '@everyone' in tag_result or '@here' in tag_result:
await self.bot.say("You cannot create a tag that mentions everyone!")
return
entry = {'server_id': ctx.message.server.id, 'tag': tag, 'result': tag_result}
r_filter = lambda row: (row['server_id'] == ctx.message.server.id) & (row['tag'] == tag)
# Try to create new entry first, if that fails (it already exists) then we update it