亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Discord.py 用戶專用命令

Discord.py 用戶專用命令

天涯盡頭無女友 2023-06-13 10:41:07
我想發出一個只有我和我的朋友可以使用的命令,但我能找到的只是有作用,但我找不到任何東西來回答我的問題,因為所有的東西都不起作用,所以有什么辦法讓它起作用如果你想知道下面的腳本@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!')


查看完整回答
反對 回復 2023-06-13
  • 1 回答
  • 0 關注
  • 147 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號