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

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

Discord.py - 檢查多個公會 ID

Discord.py - 檢查多個公會 ID

慕運維8079593 2023-10-31 14:03:37
好吧,我正在嘗試創建一個僅適用于特定公會的命令。這是代碼。如果我添加多個公會 ID,那么每個公會都可以使用此命令。async def is_guild(ctx):    return ctx.guild.id == someguildidhere, [email protected]()@commands.check(is_guild)async def checkispremium(ctx):    await ctx.send("Guild owns lifetime premium.")@checkispremium.errorasync def checkispremium(ctx, error):    if isinstance(error, commands.CheckFailure):        await ctx.send("Guild doesn't owns premium ")然而,當我只添加一個公會 ID 時,一切都會正常。只有特定公會才能使用該命令,其他公會會出錯。async def is_guild(ctx):    return ctx.guild.id == [email protected]()@commands.check(is_guild)async def checkispremium(ctx):    await ctx.send("Guild owns lifetime premium.")@checkispremium.errorasync def checkispremium(ctx, error):    if isinstance(error, commands.CheckFailure):        await ctx.send("Guild doesn't owns premium")任何人都知道我如何擁有多個公會 ID,我嘗試查看不和諧重寫文檔,但看起來什么也沒有。
查看完整描述

1 回答

?
梵蒂岡之花

TA貢獻1900條經驗 獲得超5個贊

使用

async def is_guild(ctx):
    return ctx.guild.id in [someguildidhere, someguildidhere, ...]


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

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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