Skip to content

Commit

Permalink
dont proxy voice messages + format changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruthenic committed Jan 18, 2024
1 parent 59437a5 commit c1135b3
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
7 changes: 3 additions & 4 deletions src/commands/edit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub async fn mate(
bool,
>,
#[description = "the new avatar to use when proxying"] avatar: Option<serenity::Attachment>,
#[description = "a link to an avatar to use when proxying"] avatar_url: Option<String>,
#[description = "a link to an avatar to use when proxying"] avatar_url: Option<String>,
#[description = "the mate's bio"] bio: Option<String>,
#[description = "the mate's pronouns"] pronouns: Option<String>,
#[description = "a signature to add to any proxied messages (ie `💙- text`)"] signature: Option<
Expand All @@ -53,9 +53,8 @@ pub async fn mate(
name.clone(),
avatar,
)
.await?
)

.await?,
)
}

get_mate(&mates_collection, ctx.author().id, name.clone())
Expand Down
14 changes: 12 additions & 2 deletions src/events/on_message.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anyhow::Result;
use poise::serenity_prelude::{CacheHttp, Context as SerenityContext, Message};
use anyhow::{Context, Result};
use poise::serenity_prelude::{CacheHttp, Context as SerenityContext, Message, MessageFlags};

use crate::{
commands::Data,
Expand All @@ -13,6 +13,16 @@ use crate::{
};

pub async fn run(ctx: &SerenityContext, data: &Data, message: &Message) -> Result<()> {
// FIXME: make this configurable later but immediately drop voice messages because someone asked for it
// and, as mr krabs would say: "we shall never deny a guest even the most ridiculous request"
if message
.flags
.context("how the FUCK does this message not have flags")?
.intersects(MessageFlags::IS_VOICE_MESSAGE)
{
return Ok(());
}

if message.author.bot {
return Ok(());
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/guilds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub async fn send_server_proxy_log(
let webhook = get_webhook_or_create(
http,
&channels_collection,
// SAFETY: due to the chain of database-required type changes, this is fine to unwrap as `proxy_logs_channel_id` can never be zero
// SAFETY: due to the chain of database-required type changes, this is fine to panic as `proxy_logs_channel_id` can never be zero
ChannelId::new(proxy_logs_channel_id as u64),
)
.await?;
Expand Down

0 comments on commit c1135b3

Please sign in to comment.