forked from sorceress/rustcord
Make pinned message number 1-indexed
This commit is contained in:
parent
d555c3a39f
commit
7a90770f6a
|
@ -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| {
|
||||
|
|
Loading…
Reference in New Issue