Skip to content

Commit

Permalink
used poise native guild check
Browse files Browse the repository at this point in the history
  • Loading branch information
maxwai committed Feb 11, 2024
1 parent 362e55d commit 34bb4bb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 13 deletions.
6 changes: 0 additions & 6 deletions src/bot/checks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,3 @@ pub async fn sent_in_setup_guild(ctx: Context<'_>, pool: &Pool<MySql>) -> bool {
}
false
}

/// Checks if the message was sent in a guild
#[allow(dead_code)]
pub async fn sent_in_guild(ctx: Context<'_>) -> bool {
ctx.guild_id().is_some()
}
9 changes: 2 additions & 7 deletions src/bot/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub async fn ping(ctx: Context<'_>) -> Result<(), Error> {

/// admin-only. Sets the configured logger pipe channel to the current channel.
/// If the current channel is the current logger pipe channel, it will be deactivated.
#[poise::command(prefix_command)]
#[poise::command(prefix_command, guild_only)]
pub async fn logger_pipe(ctx: Context<'_>) -> Result<(), Error> {
// Check permissions
if !checks::is_owner(ctx).await
Expand All @@ -40,12 +40,7 @@ pub async fn logger_pipe(ctx: Context<'_>) -> Result<(), Error> {
return Ok(());
}

let guild_id = if let Some(guild_id) = ctx.guild_id() {
guild_id
} else {
ctx.say("Needs to be executed in a guild").await?;
return Ok(());
};
let guild_id = ctx.guild_id().unwrap();

let db = &ctx.data().database_pool;
let db_guild = if let Some(db_guild) = mysql_lib::get_guild(db, guild_id).await {
Expand Down

0 comments on commit 34bb4bb

Please sign in to comment.