discord.py 2.0のスラッシュコマンドがすぐに適応されない

実現したいこと

discord.pyでスラッシュコマンドすぐに対応させたい

前提

discord.pyでスラッシュコマンドを作っています
スラッシュコマンド作成までは作成しました。
ですが、コマンドがdiscord側で実行できるようになるまで約15分ほどかかります

発生している問題・エラーメッセージ

コマンドを作成したらすぐにdisocrd側で実行できるようにしたい

該当のソースコード

python

1import discord 2from discord.ext import commands 3from discord import app_commands 4 5import json 6 7 8#botのconfigを読み込み9with open("config.json","r",encoding="utf-8_sig") as f:10 config = json.load(f)11 12Intents = discord.Intents.all()13 14bot = commands.Bot(15 command_prefix=config['prefix'],16 intents=Intents 17 )18 19 20@bot.event21async def on_ready():22 print("起動完了")23 #ステータスの変更24 await bot.change_presence(activity=discord.Game(name="testモードで起動中です"))25 try:26 synced = await bot.tree.sync()#スラッシュコマンドを同期27 print(f"synced {len(synced)} commands ")28 except Exception as e:29 print(e)30 31 32@bot.tree.command(name ="test",description="これはテストです。")33async def hello(interaction: discord.Interaction):34 await interaction.response.defer(ephemeral=True)35 await interaction.followup.send("testです!")36 37 38@bot.tree.command(name ="arg_test" , description="これは引数付きのテストです。")39@app_commands.describe(message = "メッセージです")40async def hello(interaction: discord.Interaction,message:str):41 await interaction.response.defer(ephemeral=True)42 await interaction.followup.send(f"testです! \n {message}")43 44 45bot.run(config['token'])

補足情報(FW/ツールのバージョンなど)

python 3.10
discord.py 2.2.2

コメントを投稿

0 コメント