Compare commits

..

9 Commits

Author SHA1 Message Date
bf6706c72c going back to a base state 2025-05-05 17:42:31 -04:00
232e62962e Merge branch 'Ruby_FreshChat4High' of https://giteas.fullmooncyberworks.com/Mystiatech/Ruby into Ruby_FreshChat4High 2025-05-05 17:40:11 -04:00
208b1f190c Revert "Goofed up what file was being edited"
This reverts commit c7a15f63ddc6fd25b2b3bda9f37c05e863ea6285.
2025-05-05 17:40:07 -04:00
ddc8db5aa4 Goofed up what file was being edited 2025-05-05 17:40:07 -04:00
23800bf323 Added all the main code to Ruby 2025-05-05 17:40:06 -04:00
151ba084f4 Revert "Goofed up what file was being edited"
This reverts commit c7a15f63ddc6fd25b2b3bda9f37c05e863ea6285.
2025-05-05 17:39:52 -04:00
c7a15f63dd Goofed up what file was being edited 2025-05-05 15:27:15 -04:00
78f60af96a Added all the main code to Ruby 2025-05-05 15:26:36 -04:00
eadbc4a91e preventing any books and .json files from being uploaded 2025-05-05 14:08:57 -04:00
2 changed files with 3 additions and 50 deletions

3
.gitignore vendored
View File

@ -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
View File

@ -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)