fixed 修改漏掉的變數 MY_GUILD_ID
This commit is contained in:
+3
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user