Re-implementing the API

This commit is contained in:
2024-12-19 13:50:31 -05:00
parent 9344979d72
commit 4a18af9014
17 changed files with 486 additions and 152 deletions

View File

@@ -9,13 +9,13 @@ use crate::data::guilds::GuildCache;
use super::{commands};
use super::chat::{create_message_response, create_modal_response};
pub struct Handler {
pub struct BotHandler {
// Open AI Config
pub oai: Option<OAI>,
}
#[async_trait]
impl EventHandler for Handler {
impl EventHandler for BotHandler {
async fn message(&self, ctx: Context, msg: Message) {
// Ignore bot messages
if msg.author.bot {
@@ -47,7 +47,8 @@ impl EventHandler for Handler {
if let None = GuildCache::get_by_id(guild_id).await.unwrap() {
let guild_cache = GuildCache {
id: guild_id,
bot_id: 1,
name: guild.id.name(&ctx.cache),
owner_id: None,
volume: 100,
};
guild_cache.insert().await.unwrap();