fix(types): use Box<str> instead String
This commit is contained in:
parent
35c1df8363
commit
51ec37b766
|
@ -41,7 +41,7 @@ pub async fn ban_member(
|
||||||
{
|
{
|
||||||
Ok(EventReturn::Cancel)
|
Ok(EventReturn::Cancel)
|
||||||
} else {
|
} else {
|
||||||
let banned_user_name: String = user.get_user_name(&bot, &message).await.unwrap();
|
let banned_user_name: Box<str> = user.get_user_name(&bot, &message).await.unwrap();
|
||||||
|
|
||||||
sender_builder
|
sender_builder
|
||||||
.reply_to(message.id())
|
.reply_to(message.id())
|
||||||
|
|
|
@ -45,7 +45,7 @@ pub async fn mute_member(
|
||||||
{
|
{
|
||||||
Ok(EventReturn::Cancel)
|
Ok(EventReturn::Cancel)
|
||||||
} else {
|
} else {
|
||||||
let muted_user_name: String = user.get_user_name(&bot, &message).await.unwrap();
|
let muted_user_name: Box<str> = user.get_user_name(&bot, &message).await.unwrap();
|
||||||
|
|
||||||
sender_builder
|
sender_builder
|
||||||
.reply_to(message.id())
|
.reply_to(message.id())
|
||||||
|
|
|
@ -46,7 +46,7 @@ pub async fn unmute_member(
|
||||||
|
|
||||||
Ok(EventReturn::Cancel)
|
Ok(EventReturn::Cancel)
|
||||||
} else {
|
} else {
|
||||||
let muted_user_name: String = user.get_user_name(&bot, &message).await.unwrap();
|
let muted_user_name: Box<str> = user.get_user_name(&bot, &message).await.unwrap();
|
||||||
|
|
||||||
sender_builder
|
sender_builder
|
||||||
.reply_to(message.id())
|
.reply_to(message.id())
|
||||||
|
|
|
@ -21,7 +21,7 @@ impl TargetUser {
|
||||||
Self::Id(_id) => true,
|
Self::Id(_id) => true,
|
||||||
Self::Reply(msg) => {
|
Self::Reply(msg) => {
|
||||||
if let Some(replied_msg) = msg.reply_to_message() {
|
if let Some(replied_msg) = msg.reply_to_message() {
|
||||||
return replied_msg.from().map(|user| user.id).is_some();
|
replied_msg.from().map(|user| user.id).is_some()
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ impl TargetUser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn get_user_name(&self, bot: &Bot, msg: &Message) -> Option<String> {
|
pub async fn get_user_name(&self, bot: &Bot, msg: &Message) -> Option<Box<str>> {
|
||||||
match self {
|
match self {
|
||||||
Self::Id(id) => {
|
Self::Id(id) => {
|
||||||
let get_chat_member_result: Result<ChatMember, SessionErrorKind> =
|
let get_chat_member_result: Result<ChatMember, SessionErrorKind> =
|
||||||
|
|
Loading…
Reference in New Issue