Implemented API Key creation/usage and changed layout of audio requests

This commit is contained in:
2024-12-21 12:03:02 -05:00
parent 4d9ee81ecf
commit ceea975836
16 changed files with 186 additions and 76 deletions

View File

@@ -89,7 +89,9 @@ pub async fn enqueue_track(
let mut playlist_items: Vec<YtDlpItem> = Vec::new();
if let Some(handler_lock) = manager.get(guild_id) {
let mut handler = handler_lock.lock().await;
let guild = GuildCache::get_by_id(guild_id.get() as i64).await?.unwrap();
let guild = GuildCache::find_by_id(guild_id.get() as i64)
.await?
.unwrap();
let valid = is_valid_url(&track_url);
// Check if the URL is valid

View File

@@ -64,7 +64,7 @@ pub async fn set_volume(manager: &Arc<Songbird>, guild_id: &GuildId, volume: i32
let bound_volume = volume as f32 / 100.0;
// Update the guild cache
let mut guild_cache = GuildCache::get_by_id(guild_id.get() as i64)
let mut guild_cache = GuildCache::find_by_id(guild_id.get() as i64)
.await
.unwrap()
.unwrap();

View File

@@ -108,7 +108,7 @@ impl EventHandler for BotHandler {
for guild in ready.guilds {
// Check if guild exists in database
let guild_id = guild.id.get() as i64;
if let None = GuildCache::get_by_id(guild_id).await.unwrap() {
if let None = GuildCache::find_by_id(guild_id).await.unwrap() {
let guild_cache = GuildCache {
id: guild_id,
name: guild.id.name(&ctx.cache),