aboutsummaryrefslogtreecommitdiff
path: root/src/commands.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands.rs')
-rw-r--r--src/commands.rs26
1 files changed, 25 insertions, 1 deletions
diff --git a/src/commands.rs b/src/commands.rs
index 086b6c3..fb31f14 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -2,9 +2,10 @@
// SPDX-License-Identifier: GPL-3.0-only
use serenity::{
- framework::standard::{macros::command, CommandResult},
+ framework::standard::{macros::command, Args, CommandResult},
model::prelude::*,
prelude::*,
+ utils::{content_safe, ContentSafeOptions},
};
#[command]
@@ -38,3 +39,26 @@ ping - pong!
Ok(())
}
+
+#[command]
+pub async fn say(ctx: &Context, msg: &Message, args: Args) -> CommandResult {
+ let settings = msg.guild_id.map_or_else(
+ || {
+ ContentSafeOptions::default()
+ .clean_channel(false)
+ .clean_role(false)
+ },
+ |guild_id| {
+ ContentSafeOptions::default()
+ .clean_channel(false)
+ .display_as_member_from(guild_id)
+ },
+ );
+
+ let content = content_safe(&ctx.cache, &args.rest(), &settings).await;
+ msg.delete(&ctx.http).await?;
+
+ msg.channel_id.say(&ctx.http, &content).await?;
+
+ Ok(())
+}