summaryrefslogtreecommitdiff
path: root/src/handlers
diff options
context:
space:
mode:
authorseth <[email protected]>2023-12-02 19:13:03 -0500
committerseth <[email protected]>2023-12-15 16:41:13 -0500
commit36bb911f312a9baa5c152cc591060b2e4f8bc930 (patch)
tree1d1eebee29c389649cea6ef446ad0fc4390f706a /src/handlers
parent0025ad5ea8d412aacc3184d18063fd5ff3de0175 (diff)
chore: register guild commands for servers that opt-in
Diffstat (limited to 'src/handlers')
-rw-r--r--src/handlers/event/message.rs12
1 files changed, 4 insertions, 8 deletions
diff --git a/src/handlers/event/message.rs b/src/handlers/event/message.rs
index 0004caf..dab2047 100644
--- a/src/handlers/event/message.rs
+++ b/src/handlers/event/message.rs
@@ -7,23 +7,19 @@ use poise::FrameworkContext;
pub async fn handle(
ctx: &Context,
- framework: FrameworkContext<'_, Data, Report>,
+ _framework: FrameworkContext<'_, Data, Report>,
msg: &Message,
data: &Data,
) -> Result<()> {
- if should_echo(framework, msg, data).await? {
+ if should_echo(ctx, msg, data).await? {
msg.reply(ctx, &msg.content).await?;
}
Ok(())
}
-async fn should_echo(
- _framework: FrameworkContext<'_, Data, Report>,
- msg: &Message,
- data: &Data,
-) -> Result<bool> {
- if msg.author.bot && msg.webhook_id.is_none() {
+async fn should_echo(ctx: &Context, msg: &Message, data: &Data) -> Result<bool> {
+ if (msg.author.bot && msg.webhook_id.is_none()) || msg.is_own(ctx) {
debug!("Not repeating another bot");
return Ok(false);
}