2025-05-06 11:56:01 -04:00
|
|
|
import os
|
2025-05-07 16:33:30 -04:00
|
|
|
import discord
|
2025-05-06 11:56:01 -04:00
|
|
|
from discord.ext import commands
|
2025-05-07 16:33:30 -04:00
|
|
|
from dotenv import load_dotenv
|
2025-05-07 17:20:34 -04:00
|
|
|
from ai import get_ai_response
|
|
|
|
|
|
2025-05-06 11:56:01 -04:00
|
|
|
|
2025-05-07 16:33:30 -04:00
|
|
|
load_dotenv()
|
|
|
|
|
TOKEN = os.getenv("DISCORD_TOKEN")
|
2025-05-06 11:56:01 -04:00
|
|
|
|
2025-05-07 16:33:30 -04:00
|
|
|
intents = discord.Intents.default()
|
|
|
|
|
intents.message_content = True
|
2025-05-06 11:56:01 -04:00
|
|
|
|
2025-05-07 16:33:30 -04:00
|
|
|
bot = commands.Bot(command_prefix="!", intents=intents)
|
2025-05-06 11:56:01 -04:00
|
|
|
|
|
|
|
|
@bot.event
|
2025-05-07 16:33:30 -04:00
|
|
|
async def on_ready():
|
|
|
|
|
print(f"✅ Logged in as {bot.user.name}")
|
2025-05-06 11:56:01 -04:00
|
|
|
|
2025-05-07 16:33:30 -04:00
|
|
|
@bot.command()
|
|
|
|
|
async def ping(ctx):
|
|
|
|
|
await ctx.send("🏓 Pong!")
|
2025-05-06 11:56:01 -04:00
|
|
|
|
2025-05-07 17:20:34 -04:00
|
|
|
@bot.command()
|
|
|
|
|
async def chat(ctx, *, message):
|
|
|
|
|
await ctx.send("🤖 Thinking...")
|
|
|
|
|
reply = get_ai_response(message)
|
|
|
|
|
await ctx.send(reply)
|
|
|
|
|
|
|
|
|
|
|
2025-05-07 16:33:30 -04:00
|
|
|
bot.run(TOKEN)
|