AI-Discord-Bot/bot.py

37 lines
836 B
Python

import os
import discord
from discord.ext import commands
from dotenv import load_dotenv
from ai import get_ai_response
from personality import apply_personality, set_persona
load_dotenv()
TOKEN = os.getenv("DISCORD_TOKEN")
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print(f"✅ Logged in as {bot.user.name}")
@bot.command()
async def ping(ctx):
await ctx.send("🏓 Pong!")
@bot.command()
async def chat(ctx, *, message):
await ctx.send("🤖 Thinking...")
reply = get_ai_response(message)
await ctx.send(reply)
@bot.command()
async def setpersona(ctx, *, description):
set_persona(description)
await ctx.send("✅ Persona updated! New style will be used in replies.")
bot.run(TOKEN)