Files
LunarHelper/main.py
T

36 lines
910 B
Python

import os
import discord
from discord.ext import commands
from config import VERSION
EXTENSIONS = [
"cogs.voice_rooms",
"cogs.signin",
"cogs.settings",
"cogs.leaderboard",
]
class LunarHelper(commands.Bot):
def __init__(self):
intents = discord.Intents.default()
intents.message_content = True # 偵測簽到文字(需在 Developer Portal 開啟)
super().__init__(command_prefix=commands.when_mentioned, intents=intents)
async def setup_hook(self):
for ext in EXTENSIONS:
await self.load_extension(ext)
await self.tree.sync()
async def on_ready(self):
print(f"Logged in as {self.user},版本{VERSION}")
if __name__ == "__main__":
token = os.getenv("DISCORD_BOT_TOKEN")
if not token:
raise SystemExit("請設定環境變數 DISCORD_BOT_TOKEN")
LunarHelper().run(token, root_logger=True)