27 lines
665 B
Python
27 lines
665 B
Python
|
import os
|
||
|
import logging
|
||
|
from dotenv import load_dotenv
|
||
|
import discord
|
||
|
from discord.ext import commands
|
||
|
from classes.my_discord_bot import setup_bot
|
||
|
|
||
|
# .env ファイルを読み込む(開発環境用)
|
||
|
load_dotenv()
|
||
|
|
||
|
if __name__ == "__main__":
|
||
|
# 環境変数名を生成
|
||
|
bot_number = os.getenv('BOT_NUMBER')
|
||
|
TOKEN_ENV = f'DISCORD_TOKEN_{bot_number}'
|
||
|
|
||
|
# 環境変数からトークンを取得
|
||
|
TOKEN = os.getenv(TOKEN_ENV)
|
||
|
|
||
|
intents = discord.Intents.default()
|
||
|
intents.guilds = True
|
||
|
intents.messages = True
|
||
|
intents.voice_states = True
|
||
|
intents.message_content = True
|
||
|
|
||
|
bot = setup_bot(intents)
|
||
|
bot.run(TOKEN)
|