Compare commits
3 commits
4f3badf5a8
...
3385bb3660
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3385bb3660 | ||
|
|
e388ddfc8c | ||
|
|
d0bedf904c |
3 changed files with 15 additions and 9 deletions
|
|
@ -20,7 +20,7 @@ async fn set_picture(slashcmd: &Set, ctx: &Context, cmd: &CommandInteraction, db
|
|||
_ => return Err(anyhow::anyhow!("Expected a subcommand")),
|
||||
};
|
||||
|
||||
let url = inner_options
|
||||
let url: &str = inner_options
|
||||
.iter()
|
||||
.find(|opt| opt.name == "link")
|
||||
.ok_or_else(|| anyhow::anyhow!("Option 'link' not found"))?
|
||||
|
|
@ -85,7 +85,7 @@ impl SlashCommand for Set {
|
|||
_database: &PgPool,
|
||||
_emoji: &EmojiConfig,
|
||||
) -> Result<()> {
|
||||
debug!("Set command called");
|
||||
debug!("{} command called", self.name());
|
||||
if !is_owner(_database, &command.user.id.to_string()).await? {
|
||||
let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new()
|
||||
.content(format!("{} | This command is only for the owner", _emoji.answer.no))
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ impl SlashCommand for Clear {
|
|||
_database: &PgPool,
|
||||
_emoji: &EmojiConfig,
|
||||
) -> Result<()> {
|
||||
debug!("Clear command called");
|
||||
debug!("{} command called", self.name());
|
||||
let amount: u8 = command.data.options.iter().find(|opt | opt.kind() == CommandOptionType::Integer)
|
||||
.unwrap().value.as_i64().expect("REASON") as u8;
|
||||
let message: CreateInteractionResponseMessage = CreateInteractionResponseMessage::new()
|
||||
|
|
|
|||
6
src/utils/format.rs
Normal file
6
src/utils/format.rs
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
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)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue