Reputation: 84
I just made blacklist in my bot, and still I can use bot even though I blacklisted myself. This is my code:
BLACKLIST = ["my ID"]
@bot.command()
async def testblacklist(ctx):
if ctx.author.id in BLACKLIST:
await ctx.send("U r on blacklist!")
else:
await ctx.send("Test")
Can anyone help me with this? There aren't any errors in console and bot sends "Test"
Upvotes: 0
Views: 83
Reputation: 1415
That's because in BLACKLIST
your id is a str
and ctx.author.id
is int
. You have 2 options:
if ctx.author.id in BLACKLIST:
with:
if str(ctx.author.id) in BLACKLIST:
int
as your id in BLACKLIST
Upvotes: 1