So I made this command that owners can use to send a message to someone using the bot for moderation purposes so um that part works and it sends the message but I added an if statement and it is supposed to only work if the people with the ids i added were using it but it just works for everyone and anyone can use it and i'm getting no errors and i'm sure that the ids are correct. The code is below.
@commands.command()
async def dm(self, ctx, member:discord.Member=None, *, message=None):
m1 = self.client.get_user(775277904481353749)
m2 = self.client.get_user(709295989596356609)
if member == None:
await ctx.send("You have to mention the user that you want to send a message to!")
return
if message == None:
await ctx.send("You have to type the message that you want to send to the mentioned user!")
return
if ctx.message.author == m1 or m2:
await member.send(message)
await ctx.send(f"Successfully sent your message to **{member.name}#{member.discriminator}**")
else:
await ctx.send("You can't use this command!")
return
You can't compare two variables like this. what you did is equivalent to
if (ctx.message.author == m1) or (bool(m2) == True):
And m2
is always true if 709295989596356609
correspond to a valid member, that's why everyone can use it.
You need to do
if ctx.message.author == m1 or ctx.message.author == m2: