好吧,我正在嘗試創(chuàng)建一個(gè)僅適用于特定公會(huì)的命令。這是代碼。如果我添加多個(gè)公會(huì) ID,那么每個(gè)公會(huì)都可以使用此命令。async def is_guild(ctx): return ctx.guild.id == someguildidhere, someguildidhere@client.command()@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 ")然而,當(dāng)我只添加一個(gè)公會(huì) ID 時(shí),一切都會(huì)正常。只有特定公會(huì)才能使用該命令,其他公會(huì)會(huì)出錯(cuò)。async def is_guild(ctx): return ctx.guild.id == someguildidhere@client.command()@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")任何人都知道我如何擁有多個(gè)公會(huì) ID,我嘗試查看不和諧重寫文檔,但看起來什么也沒有。
Discord.py - 檢查多個(gè)公會(huì) ID
慕運(yùn)維8079593
2023-10-31 14:03:37