Files
Pheobe/phoebe/discord_bot.py
Dan 75f1116b3b Fix: Moved the Files around due to imports not working right
Feat: Phoebe replies but it's gibbish
This is a version break because of the file structure change.
2024-05-15 20:13:35 -04:00

36 lines
775 B
Python

import discord
import os
from dotenv import load_dotenv
from train_gpt_model import process_message
from gpt_model import load_model
load_dotenv()
# Discord bot token
TOKEN = os.getenv("DISCORD_TOKEN")
# Initialize Discord client
intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print(f"We have logged in as {client.user}")
load_model(5641, "phoebe_model.pt")
@client.event
async def on_message(message):
if message.author == client.user:
return
# Process the message and get a response
response = process_message(message.content)
# Send the response back to the Discord channel
await message.channel.send(response)
client.run(TOKEN)