discord-py-slash-commandのグローバルコマンドとギルドコマンドの違い
グローバルコマンド
code:global_command.py
@slash.slash(name="ping")
async def _ping(ctx): # Defines a new "context" (ctx) command called "ping."
await ctx.send(f"Pong! ({client.latency*1000}ms)")
デコレータのパラメータに、guild_idsが存在しない場合、グローバルコマンドとして扱われます
グローバルコマンドは、使えるようになるまで1時間程度かかることがあります(スラッシュコマンド#60632b9ffd049e0000504e98)
ギルドコマンド
code:guild_command.py
guild_ids = 789032594456576001 # Put your server ID in this array.
@slash.slash(name="ping", guild_ids=guild_ids)
async def _ping(ctx): # Defines a new "context" (ctx) command called "ping."
await ctx.send(f"Pong! ({client.latency*1000}ms)")
デコレータのパラメータに、guild_idsが存在する場合、ギルドコマンドとして扱われます
すぐさま、スラッシュコマンドを使用できます(テストなどで自分用のギルドで試したりするのに便利です)
ギルドコマンドが邪魔になった場合、discord-py-slash-commandでギルドコマンドにゴミが残ってしまった場合の対応を行い削除できます
参考
Quickstart — discord-py-slash-command documentation
スラッシュコマンド
これはdiscord-py-interactionsについての説明です