cadence_caster/app.py
2024-12-15 11:40:06 -06:00

35 lines
820 B
Python

import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
from tasks import start_task_loop
from commands import setup_commands
# Load environment variables
load_dotenv()
# Setup
TOKEN = os.getenv("DISCORD_TOKEN")
CHANNEL_ID = int(os.getenv("CHANNEL_ID"))
intents = discord.Intents.default()
intents.messages = True
intents.message_content = True
intents.guilds = True
intents.guild_messages = True
bot = commands.Bot(command_prefix="!", intents=intents)
# Event handler for bot ready
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
channel = bot.get_channel(CHANNEL_ID)
if channel:
await channel.send("CadenceCaster bot is now online!")
start_task_loop(bot, CHANNEL_ID)
# Register commands
setup_commands(bot)
# Run the bot
bot.run(TOKEN)