remove dead code

This commit is contained in:
Gabriel Fontes
2023-06-12 09:49:39 -03:00
parent 3b3ff9106b
commit 5bd8e2ab57
5 changed files with 10 additions and 33 deletions

View File

@@ -1,5 +1,8 @@
use anyhow::{anyhow, Result};
use serenity::all::{ChannelId, Guild};
use serenity::{
all::{ChannelId, Guild},
prelude::TypeMapKey,
};
use songbird::{
input::HttpRequest,
tracks::{Track, TrackHandle},
@@ -10,7 +13,10 @@ use tokio::sync::Mutex;
use std::sync::Arc;
use crate::handles::SubsonicSongHandle;
pub struct SongHandle;
impl TypeMapKey for SongHandle {
type Value = Song;
}
pub struct Data {
pub subsonic_client: sunk::Client,
@@ -24,7 +30,7 @@ pub async fn queue_song(ctx: Context<'_>, song: &Song, client: &sunk::Client) ->
let track = load_song(song, client).await?;
let track_handle = handler.enqueue(track).await;
let mut type_map = track_handle.typemap().write().await;
type_map.insert::<SubsonicSongHandle>(song.clone());
type_map.insert::<SongHandle>(song.clone());
Ok(())
}
@@ -70,7 +76,7 @@ pub async fn get_song(track: &TrackHandle) -> Result<Song> {
.typemap()
.read()
.await
.get::<SubsonicSongHandle>()
.get::<SongHandle>()
.map(ToOwned::to_owned)
.ok_or_else(|| anyhow!("Sound information not found"))?;
Ok(song)

View File

@@ -1,14 +0,0 @@
use serenity::{
all::Ready,
async_trait,
prelude::{Context, EventHandler},
};
pub struct Handler;
#[async_trait]
impl EventHandler for Handler {
async fn ready(&self, _: Context, ready: Ready) {
log::info!("{} is connected!", ready.user.name);
}
}

View File

@@ -1,8 +1,6 @@
pub mod client;
pub mod commands;
pub mod common;
pub mod handler;
pub use client::create_client;
pub use common::{Context, Data};
pub use handler::Handler;

View File

@@ -1,12 +0,0 @@
use serenity::prelude::TypeMapKey;
use sunk::{song::Song as SubsonicSong, Client as SubsonicClient};
pub struct SubsonicClientHandle;
impl TypeMapKey for SubsonicClientHandle {
type Value = SubsonicClient;
}
pub struct SubsonicSongHandle;
impl TypeMapKey for SubsonicSongHandle {
type Value = SubsonicSong;
}

View File

@@ -1,3 +1,2 @@
pub mod config;
pub mod discord;
pub mod handles;