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.
This commit is contained in:
35
phoebe/discord_bot.py
Normal file
35
phoebe/discord_bot.py
Normal file
@ -0,0 +1,35 @@
|
||||
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)
|
Reference in New Issue
Block a user