Make pinned message number 1-indexed

This commit is contained in:
Agatha Rose 2020-05-23 19:51:43 +03:00
parent 9887e8ef45
commit cc1d978e5f
1 changed files with 5 additions and 2 deletions

View File

@ -655,7 +655,10 @@ fn pinned(ctx: &mut Context, message: &Message, mut args: Args) -> CommandResult
));
}
};
let idx = args.single::<usize>().unwrap_or(0);
let mut idx = args.single::<usize>().unwrap_or(1);
if idx != 0 {
idx -= 1;
}
if pinned.is_empty() {
return Err(CommandError("No pinned messages found!".to_string()));
}
@ -665,7 +668,7 @@ fn pinned(ctx: &mut Context, message: &Message, mut args: Args) -> CommandResult
let _ = message.channel_id.send_message(&ctx.http, |m| {
m.embed(|e| {
e.title(format!("Pinned message #{}", idx))
e.title(format!("Pinned message #{}", idx + 1))
.description(&pinned[idx].content)
.timestamp(&pinned[idx].timestamp);
e.author(|a| {