dynamic config reloading
This commit is contained in:
10
main.py
10
main.py
@@ -1,7 +1,7 @@
|
||||
# main.py
|
||||
import discord
|
||||
from discord.ext import commands
|
||||
from config import ALLOWED_CHANNEL_ID, HIT_CHECK_INTERVAL, REASSIGN_DELAY, DISCORD_TOKEN
|
||||
import config as app_config
|
||||
from cogs.assignments import Assignments
|
||||
from cogs.commands import HitCommands
|
||||
|
||||
@@ -51,8 +51,8 @@ class HitDispatchBot(commands.Bot):
|
||||
enemy_queue=enemy_queue,
|
||||
active_assignments=active_assignments,
|
||||
enrolled_attackers=enrolled_attackers,
|
||||
hit_check=HIT_CHECK_INTERVAL,
|
||||
reassign_delay=REASSIGN_DELAY,
|
||||
hit_check=app_config.HIT_CHECK_INTERVAL,
|
||||
reassign_delay=app_config.REASSIGN_DELAY,
|
||||
)
|
||||
)
|
||||
|
||||
@@ -65,7 +65,7 @@ class HitDispatchBot(commands.Bot):
|
||||
)
|
||||
|
||||
async def cog_check(self, ctx):
|
||||
return ctx.channel.id == ALLOWED_CHANNEL_ID
|
||||
return ctx.channel.id == app_config.ALLOWED_CHANNEL_ID
|
||||
|
||||
bot = HitDispatchBot(command_prefix="!", intents=intents)
|
||||
|
||||
@@ -90,7 +90,7 @@ async def on_ready():
|
||||
async def start_bot():
|
||||
try:
|
||||
print("Starting Discord bot...")
|
||||
await bot.start(DISCORD_TOKEN)
|
||||
await bot.start(app_config.DISCORD_TOKEN)
|
||||
except discord.LoginFailure:
|
||||
print("ERROR: Invalid Discord token! Please set DISCORD_TOKEN in config.py")
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user