Compare commits
9 Commits
main
...
Ruby_Fresh
Author | SHA1 | Date | |
---|---|---|---|
bf6706c72c | |||
232e62962e | |||
208b1f190c | |||
ddc8db5aa4 | |||
23800bf323 | |||
151ba084f4 | |||
c7a15f63dd | |||
78f60af96a | |||
eadbc4a91e |
3
.gitignore
vendored
3
.gitignore
vendored
@ -168,3 +168,6 @@ cython_debug/
|
|||||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||||
#.idea/
|
#.idea/
|
||||||
|
|
||||||
|
books/*
|
||||||
|
*.json
|
||||||
|
models/best_gen.pt
|
||||||
|
50
main.py
50
main.py
@ -1,50 +0,0 @@
|
|||||||
import discord
|
|
||||||
import os
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
# Load environment
|
|
||||||
load_dotenv()
|
|
||||||
TOKEN = os.getenv("DISCORD_TOKEN")
|
|
||||||
|
|
||||||
if not TOKEN:
|
|
||||||
raise RuntimeError("Bot token not found in .env")
|
|
||||||
|
|
||||||
# Setup intents
|
|
||||||
intents = discord.Intents.default()
|
|
||||||
intents.message_content = True
|
|
||||||
intents.dm_messages = True
|
|
||||||
intents = intents
|
|
||||||
|
|
||||||
class Ruby(discord.Client):
|
|
||||||
def __init__(self):
|
|
||||||
super().__init__(intents=intents)
|
|
||||||
self.log_path = os.path.join("logs", "messages.log")
|
|
||||||
os.makedirs("logs", exist_ok=True)
|
|
||||||
|
|
||||||
async def on_ready(self):
|
|
||||||
print(f"[READY] Logged in as {self.user} (ID: {self.user.id})")
|
|
||||||
|
|
||||||
async def on_message(self, message: discord.Message):
|
|
||||||
if message.author.id == self.user.id:
|
|
||||||
return # ignore self
|
|
||||||
|
|
||||||
self.log_message(message)
|
|
||||||
self.train_on_message(message)
|
|
||||||
|
|
||||||
def log_message(self, message: discord.Message):
|
|
||||||
timestamp = datetime.utcnow().isoformat()
|
|
||||||
log_entry = f"{timestamp} | {message.author.name} | {message.content.strip()}\n"
|
|
||||||
|
|
||||||
with open(self.log_path, "a", encoding="utf-8") as f:
|
|
||||||
f.write(log_entry)
|
|
||||||
|
|
||||||
print(f"[LOGGED] {log_entry.strip()}")
|
|
||||||
|
|
||||||
def train_on_message(self, message: discord.Message):
|
|
||||||
print(f"[TRAIN] Simulating training on: \"{message.content.strip()}\"")
|
|
||||||
|
|
||||||
# Run Ruby
|
|
||||||
|
|
||||||
client = Ruby()
|
|
||||||
client.run(TOKEN)
|
|
Loading…
x
Reference in New Issue
Block a user