aboutsummaryrefslogtreecommitdiff
path: root/src/util/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/mod.rs')
-rw-r--r--src/util/mod.rs34
1 files changed, 23 insertions, 11 deletions
diff --git a/src/util/mod.rs b/src/util/mod.rs
index 474d36d..395d264 100644
--- a/src/util/mod.rs
+++ b/src/util/mod.rs
@@ -141,9 +141,14 @@ pub async fn reply<U, E>(
ctx: poise::Context<'_, U, E>,
text: impl AsRef<str>,
) -> Result<poise::ReplyHandle, serenity::Error> {
- let handle =
- poise::send_reply(ctx, CreateReply::default().tts(unwrap_tts(ctx)).content(text.as_ref()))
- .await?;
+ let handle = poise::send_reply(
+ ctx,
+ CreateReply::default()
+ .tts(unwrap_tts(ctx))
+ .content(text.as_ref())
+ .allowed_mentions(Default::default()),
+ )
+ .await?;
Ok(handle)
}
@@ -252,28 +257,35 @@ pub async fn send_result(
let text = text.as_ref();
tracing::debug!(text, %channel, tts, "sending message");
- let result = channel.send_message(ctx, CreateMessage::default().content(text).tts(tts)).await?;
+ let result = channel
+ .send_message(
+ ctx,
+ CreateMessage::default().content(text).tts(tts).allowed_mentions(Default::default()),
+ )
+ .await?;
Ok(result.id)
}
lazy_static! {
- static ref REQUIRED_PERMS: Permissions = Permissions::EMBED_LINKS
+ pub static ref REQUIRED_PERMS: Permissions = Permissions::EMBED_LINKS
+ | Permissions::VIEW_CHANNEL
| Permissions::ADD_REACTIONS
+ | Permissions::READ_MESSAGE_HISTORY // need this in order to delete message reactions
| Permissions::SEND_MESSAGES
- | Permissions::SEND_TTS_MESSAGES
- | Permissions::MENTION_EVERYONE
- | Permissions::USE_EXTERNAL_EMOJIS
| Permissions::CONNECT
| Permissions::SPEAK
+ | Permissions::ATTACH_FILES
+ | Permissions::SEND_MESSAGES_IN_THREADS;
+ pub static ref DESIRED_PERMS: Permissions = *REQUIRED_PERMS
+ | Permissions::USE_EXTERNAL_EMOJIS
| Permissions::CHANGE_NICKNAME
- | Permissions::USE_VAD
- | Permissions::ATTACH_FILES;
+ | Permissions::SEND_TTS_MESSAGES;
}
lazy_static! {
pub static ref OAUTH_URL: Url = Url::parse(&format!(
"https://discordapp.com/api/oauth2/authorize?scope=bot&permissions={}&client_id={}",
- REQUIRED_PERMS.bits(),
+ DESIRED_PERMS.bits(),
CONFIG.discord.auth.client_id,
))
.unwrap();