from discord.ext import commands import discord import json import asyncio
bot = commands.Bot(command_prefix="!")
withopen('items.json', "r", encoding = "utf8") as file: data = json.load(file) token = data["token"] # python3.12強制更動為雙引
@bot.event asyncdefon_ready(): print("Bot in ready")
# bot 開機開啟.py檔案 asyncdefload_extensions(): # 先建立cogs資料夾 for filename in os.listdir("./cogs"): if filename.endswith(".py"): await bot.load_extension(f"cogs.{filename[:-3]}") # 先建立cmds資料夾 for filename in os.listdir("./cmds"): if filename.endswith(".py"): await bot.load_extension(f"cmds.{filename[:-3]}")