Fix User/Role/Channel id parsing (#35)

* Import thiserror to make nicer errors

* Create wrappers for id that exposes old parsing behavior (from mentions)

* Use id wrappers when parsing parameters
This commit is contained in:
Natsu Kagami 2024-02-28 18:02:42 +00:00 committed by GitHub
parent 431f295b41
commit b4cf6ce94f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 91 additions and 21 deletions

View file

@ -7,7 +7,7 @@ use serenity::{
macros::{command, group},
Args, CommandResult,
},
model::{channel::Message, id::UserId},
model::channel::Message,
utils::MessageBuilder,
};
use youmubot_prelude::*;
@ -159,7 +159,7 @@ async fn name(ctx: &Context, msg: &Message, mut args: Args) -> CommandResult {
let user_id = if args.is_empty() {
msg.author.id
} else {
args.single::<UserId>()?
args.single::<UserId>()?.0
};
let user_mention = if user_id == msg.author.id {