fixed 修改漏掉的變數 MY_GUILD_ID

This commit is contained in:
tangsong
2026-03-04 01:27:56 +08:00
parent 50d60bf97c
commit 054a7e62dd
2 changed files with 11 additions and 4 deletions
+3 -1
View File
@@ -12,6 +12,8 @@ load_dotenv()
# 設定 bot token
TOKEN = os.getenv('DISCORD_BOT_TOKEN')
# 從環境變數讀取 Guild ID 並轉型為 int
MY_GUILD_ID = int(os.getenv('GUILD_ID'))
# 設定 bot
intents = discord.Intents.default()
@@ -42,7 +44,7 @@ async def on_ready():
# 同步 Slash Commands 到指定伺服器
try:
guild = discord.Object(id=605678541530726421)
guild = discord.Object(id=MY_GUILD_ID)
synced = await bot.tree.sync(guild=guild)
print(f'✅ 已同步 {len(synced)} 個 Slash Commands 到伺服器 {guild.id}')
for cmd in synced: