How to make an annoucement command that can only triggered by me in dm (nextcord)

So, I am going to make an annoucement command that only can triggered by me and by dm the bot

@commands.has_any_role('BasicLolGaming', 'MODERATOR', 442186820977950720)
async def pemberitauan(ctx):
    embed= nextcord.Embed(
        color= nextcord.Color.dark_red()
    embed.set_author(name='Kentod', icon_url='')

    channel = client.get_channel(803585009692835851)
    await channel.send(embed=embed)

This code works for me only if i write it the command in the server. but, i want can triggered the code by dm the bot

>Solution :

Use check @commands.is_owner() check instead of @commands.has_any_role('BasicLolGaming', 'MODERATOR', 442186820977950720). And add owner_ids=[your_id] kwarg in your client initialization.
For example

client = Bot(command_prefix="!", owner_ids=[your_id])

Leave a Reply