mirror of
https://github.com/eRgo35/lyra.git
synced 2026-02-04 04:16:11 +01:00
reformatting
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
use serenity::framework::standard::macros::command;
|
use serenity::framework::standard::macros::command;
|
||||||
use serenity::framework::standard::CommandResult;
|
use serenity::framework::standard::CommandResult;
|
||||||
|
use serenity::model::prelude::*;
|
||||||
|
use serenity::prelude::*;
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
use crate::commands::misc::check_msg;
|
||||||
|
|
||||||
@@ -11,16 +11,16 @@ async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
let guild_id = msg.guild_id.unwrap();
|
let guild_id = msg.guild_id.unwrap();
|
||||||
|
|
||||||
let manager = songbird::get(ctx)
|
let manager = songbird::get(ctx)
|
||||||
.await
|
.await
|
||||||
.expect("Client placed at init")
|
.expect("Client placed at init")
|
||||||
.clone();
|
.clone();
|
||||||
|
|
||||||
let handler_lock = match manager.get(guild_id) {
|
let handler_lock = match manager.get(guild_id) {
|
||||||
Some(handler) => handler,
|
Some(handler) => handler,
|
||||||
None => {
|
None => {
|
||||||
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
||||||
|
|
||||||
return Ok(())
|
return Ok(());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -28,14 +28,17 @@ async fn deafen(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
|
|
||||||
if handler.is_deaf() {
|
if handler.is_deaf() {
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Already deafened").await);
|
check_msg(msg.channel_id.say(&ctx.http, "Already deafened").await);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if let Err(err) = handler.deafen(true).await {
|
if let Err(err) = handler.deafen(true).await {
|
||||||
check_msg(msg.channel_id.say(&ctx.http, format!("Failed: {:?}", err)).await);
|
check_msg(
|
||||||
|
msg.channel_id
|
||||||
|
.say(&ctx.http, format!("Failed: {:?}", err))
|
||||||
|
.await,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Deafened").await);
|
check_msg(msg.channel_id.say(&ctx.http, "Deafened").await);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
use serenity::async_trait;
|
use serenity::async_trait;
|
||||||
use serenity::model::prelude::*;
|
|
||||||
use serenity::prelude::*;
|
|
||||||
use serenity::framework::standard::macros::command;
|
use serenity::framework::standard::macros::command;
|
||||||
use serenity::framework::standard::CommandResult;
|
use serenity::framework::standard::CommandResult;
|
||||||
|
use serenity::model::prelude::*;
|
||||||
|
use serenity::prelude::*;
|
||||||
use songbird::events::{Event, EventContext, EventHandler as VoiceEventHandler, TrackEvent};
|
use songbird::events::{Event, EventContext, EventHandler as VoiceEventHandler, TrackEvent};
|
||||||
|
|
||||||
use crate::commands::misc::check_msg;
|
use crate::commands::misc::check_msg;
|
||||||
@@ -58,4 +58,4 @@ impl VoiceEventHandler for TrackErrorNotifier {
|
|||||||
}
|
}
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,15 @@ async fn leave(ctx: &Context, msg: &Message) -> CommandResult {
|
|||||||
|
|
||||||
if has_handler {
|
if has_handler {
|
||||||
if let Err(err) = manager.remove(guild_id).await {
|
if let Err(err) = manager.remove(guild_id).await {
|
||||||
check_msg(msg.channel_id.say(&ctx.http, format!("Failed: {:?}", err)).await);
|
check_msg(
|
||||||
|
msg.channel_id
|
||||||
|
.say(&ctx.http, format!("Failed: {:?}", err))
|
||||||
|
.await,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
check_msg(msg.channel_id.say(&ctx.http, "Left voice channel").await);
|
check_msg(msg.channel_id.say(&ctx.http, "Left voice channel").await);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
check_msg(msg.reply(ctx, "Not in a voice channel").await);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
pub mod join;
|
|
||||||
pub mod deafen;
|
pub mod deafen;
|
||||||
pub mod leave;
|
pub mod join;
|
||||||
|
pub mod leave;
|
||||||
|
pub mod mute;
|
||||||
12
src/main.rs
12
src/main.rs
@@ -8,10 +8,7 @@ use serenity::{
|
|||||||
async_trait,
|
async_trait,
|
||||||
client::{Client, EventHandler},
|
client::{Client, EventHandler},
|
||||||
framework::{
|
framework::{
|
||||||
standard::{
|
standard::{macros::group, Configuration},
|
||||||
macros::group,
|
|
||||||
Configuration,
|
|
||||||
},
|
|
||||||
StandardFramework,
|
StandardFramework,
|
||||||
},
|
},
|
||||||
model::gateway::Ready,
|
model::gateway::Ready,
|
||||||
@@ -20,9 +17,10 @@ use serenity::{
|
|||||||
|
|
||||||
mod commands;
|
mod commands;
|
||||||
|
|
||||||
use crate::commands::music::join::*;
|
|
||||||
use crate::commands::music::deafen::*;
|
use crate::commands::music::deafen::*;
|
||||||
|
use crate::commands::music::join::*;
|
||||||
use crate::commands::music::leave::*;
|
use crate::commands::music::leave::*;
|
||||||
|
use crate::commands::music::mute::*;
|
||||||
|
|
||||||
struct HttpKey;
|
struct HttpKey;
|
||||||
|
|
||||||
@@ -40,9 +38,7 @@ impl EventHandler for Handler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[group]
|
#[group]
|
||||||
#[commands(
|
#[commands(join, deafen, leave, mute)]
|
||||||
join, deafen, leave
|
|
||||||
)]
|
|
||||||
struct General;
|
struct General;
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
|
|||||||
Reference in New Issue
Block a user