我想發出一個只有我和我的朋友可以使用的命令,但我能找到的只是有作用,但我找不到任何東西來回答我的問題,因為所有的東西都不起作用,所以有什么辦法讓它起作用如果你想知道下面的腳本@client.command(aliases=['rl'])@commands.has_role('3Peak-Bot-Dev-[RN/ou3PwQFA9uqbXSa6E+ClZJA3uTjK3n3Sl7g5hins=]')async def reload(ctx): guild = ctx.guild embed = discord.Embed(title = f'Reloading!', color = 0xff6300) await ctx.send(embed=embed) return await ctx.bot.logout()
1 回答

www說
TA貢獻1775條經驗 獲得超8個贊
您可以添加代碼來檢查該命令是否由您或您的朋友使用該 ID 執行,例如:
@client.command(aliases=['rl'])
async def reload(ctx):
? ? yourID = 1234567890
? ? friendID = 1234567890
? ? if ctx.message.author.id == yourID or ctx.message.author.id == friendID:
? ? ? ? # Do something
? ? else:
? ? ? ? await ctx.send('You are not allowed to execute this command!')
添加回答
舉報
0/150
提交
取消