gotta archive this lmao
This commit is contained in:
78
app.py
Normal file → Executable file
78
app.py
Normal file → Executable file
@@ -1,40 +1,40 @@
|
||||
import os
|
||||
import logging
|
||||
from dotenv import load_dotenv
|
||||
import pytz
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
|
||||
from discord_logic import bot, setup_discord_bot, send_quote, after_class
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
|
||||
DISCORD_TOKEN = os.getenv('DISCORD_TOKEN')
|
||||
|
||||
# Logging.
|
||||
logging.basicConfig(
|
||||
filename=f"./logs/jacobs.log",
|
||||
filemode="at+",
|
||||
level=logging.DEBUG if os.getenv('DEBUG') == "True" else logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
setup_discord_bot(bot)
|
||||
|
||||
@bot.event
|
||||
async def on_ready() -> None:
|
||||
"""Event handler for when the bot is initialized."""
|
||||
logger.info(f"{bot.user.name} has connected to Discord and is ready.")
|
||||
print(f"{bot.user.name} is ready.")
|
||||
|
||||
# After successful initialization, schedule tasks.
|
||||
task_scheduler = BackgroundScheduler(timezone=pytz.timezone('EDT'))
|
||||
task_scheduler.add_job(lambda: bot.loop.create_task(send_quote()), 'cron', day_of_week='mon-fri', hour=8, minute=50)
|
||||
task_scheduler.add_job(lambda: bot.loop.create_task(send_quote()), 'cron', day_of_week='mon-fri', hour='8-14', minute="*/20", jitter=180)
|
||||
task_scheduler.add_job(lambda: bot.loop.create_task(after_class()), 'cron', day_of_week='mon-fri', hour=10, minute=55)
|
||||
task_scheduler.start()
|
||||
|
||||
logger.info("Presumably successfully initialized, starting bot.")
|
||||
import os
|
||||
import logging
|
||||
from dotenv import load_dotenv
|
||||
import pytz
|
||||
|
||||
from apscheduler.schedulers.background import BackgroundScheduler
|
||||
|
||||
from discord_logic import bot, setup_discord_bot, send_quote, after_class
|
||||
|
||||
# Load environment variables
|
||||
load_dotenv()
|
||||
|
||||
DISCORD_TOKEN = os.getenv('DISCORD_TOKEN')
|
||||
|
||||
# Logging.
|
||||
logging.basicConfig(
|
||||
filename=f"./logs/jacobs.log",
|
||||
filemode="at+",
|
||||
level=logging.DEBUG if os.getenv('DEBUG') == "True" else logging.INFO,
|
||||
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
||||
)
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
setup_discord_bot(bot)
|
||||
|
||||
@bot.event
|
||||
async def on_ready() -> None:
|
||||
"""Event handler for when the bot is initialized."""
|
||||
logger.info(f"{bot.user.name} has connected to Discord and is ready.")
|
||||
print(f"{bot.user.name} is ready.")
|
||||
|
||||
# After successful initialization, schedule tasks.
|
||||
task_scheduler = BackgroundScheduler(timezone=pytz.timezone('EST'))
|
||||
task_scheduler.add_job(lambda: bot.loop.create_task(send_quote()), 'cron', day_of_week='mon-fri', hour=8, minute=50)
|
||||
task_scheduler.add_job(lambda: bot.loop.create_task(send_quote()), 'cron', day_of_week='mon-fri', hour='8-14', minute="*/20", jitter=180)
|
||||
task_scheduler.add_job(lambda: bot.loop.create_task(after_class()), 'cron', day_of_week='mon-fri', hour=10, minute=55)
|
||||
task_scheduler.start()
|
||||
|
||||
logger.info("Presumably successfully initialized, starting bot.")
|
||||
bot.run(DISCORD_TOKEN)
|
||||
Reference in New Issue
Block a user