40 lines
986 B
Python
40 lines
986 B
Python
import os
|
|
import asyncio
|
|
from dotenv import load_dotenv
|
|
import discord
|
|
from core.brain import Brain
|
|
|
|
load_dotenv()
|
|
TOKEN = os.getenv('DISCORD_TOKEN')
|
|
if not TOKEN:
|
|
raise RuntimeError('DISCORD_TOKEN not set in .env')
|
|
|
|
STATUS_CHANNEL_ID = 1371307441400184883 # ← replace with your channel ID
|
|
|
|
intents = discord.Intents.default()
|
|
intents.message_content = True
|
|
|
|
client = discord.Client(intents=intents)
|
|
brain = Brain(client=client, status_channel_id=STATUS_CHANNEL_ID)
|
|
|
|
@client.event
|
|
async def on_ready():
|
|
print(f'🚀 Logged in as {client.user} (ID: {client.user.id})')
|
|
# fire-and-forget the online trainer
|
|
asyncio.create_task(brain.train_online())
|
|
|
|
@client.event
|
|
async def on_message(message):
|
|
if message.author.bot:
|
|
return
|
|
reply = await brain.generate_response(
|
|
message.content,
|
|
max_new_tokens=200,
|
|
temperature=1.0,
|
|
top_k=50
|
|
)
|
|
await message.channel.send(reply)
|
|
|
|
if __name__ == '__main__':
|
|
client.run(TOKEN)
|