Compare commits

..

No commits in common. "3385bb36602deab8fa5981659f6830955219d41c" and "4f3badf5a8045c6d70d1c77f64c8b673dbf52163" have entirely different histories.

3 changed files with 9 additions and 15 deletions

View file

@ -20,13 +20,13 @@ async fn set_picture(slashcmd: &Set, ctx: &Context, cmd: &CommandInteraction, db
_ => return Err(anyhow::anyhow!("Expected a subcommand")), _ => return Err(anyhow::anyhow!("Expected a subcommand")),
}; };
let url: &str = inner_options let url = inner_options
.iter() .iter()
.find(|opt| opt.name == "link") .find(|opt| opt.name == "link")
.ok_or_else(|| anyhow::anyhow!("Option 'link' not found"))? .ok_or_else(|| anyhow::anyhow!("Option 'link' not found"))?
.value .value
.as_str() .as_str()
.ok_or_else(|| anyhow::anyhow!("Option 'link' is not a string"))?; .ok_or_else(|| anyhow::anyhow!("Option 'link' is not a string"))?;
let attachment: CreateAttachment = CreateAttachment::url(&ctx.http, &url) let attachment: CreateAttachment = CreateAttachment::url(&ctx.http, &url)
.await?; .await?;
@ -85,7 +85,7 @@ impl SlashCommand for Set {
_database: &PgPool, _database: &PgPool,
_emoji: &EmojiConfig, _emoji: &EmojiConfig,
) -> Result<()> { ) -> Result<()> {
debug!("{} command called", self.name()); debug!("Set command called");
if !is_owner(_database, &command.user.id.to_string()).await? { if !is_owner(_database, &command.user.id.to_string()).await? {
let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new() let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new()
.content(format!("{} | This command is only for the owner", _emoji.answer.no)) .content(format!("{} | This command is only for the owner", _emoji.answer.no))

View file

@ -50,7 +50,7 @@ impl SlashCommand for Clear {
_database: &PgPool, _database: &PgPool,
_emoji: &EmojiConfig, _emoji: &EmojiConfig,
) -> Result<()> { ) -> Result<()> {
debug!("{} command called", self.name()); debug!("Clear command called");
let amount: u8 = command.data.options.iter().find(|opt | opt.kind() == CommandOptionType::Integer) let amount: u8 = command.data.options.iter().find(|opt | opt.kind() == CommandOptionType::Integer)
.unwrap().value.as_i64().expect("REASON") as u8; .unwrap().value.as_i64().expect("REASON") as u8;
let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new() let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new()

View file

@ -1,6 +0,0 @@
pub fn format_sanction_reason(module_name:&str, reason: Option<&str>, executor: &str) -> String {
match reason {
Some(s) => format!("[TTY {}] {} by {}", module_name, s, executor),
None => format!("[TTY {}] by {}", module_name, executor)
}
}