Send random_list to a user's dms
+ just fmt still
This commit is contained in:
parent
95b965a4a9
commit
ac6bd108da
@ -170,6 +170,7 @@ pub async fn list_random(ctx: &Context, msg: &Message, args: Args) -> CommandRes
|
|||||||
|
|
||||||
let random = RandomConfig::get_random(&global_data.db, &random_name)?;
|
let random = RandomConfig::get_random(&global_data.db, &random_name)?;
|
||||||
|
|
||||||
|
let dm_channel = msg.author.id.create_dm_channel(&ctx.http).await?;
|
||||||
if let Some(random) = random {
|
if let Some(random) = random {
|
||||||
let mut msg_builder = MessageBuilder::new();
|
let mut msg_builder = MessageBuilder::new();
|
||||||
msg_builder.push_line(format!("All possible responses for {}:", random_name));
|
msg_builder.push_line(format!("All possible responses for {}:", random_name));
|
||||||
@ -178,7 +179,7 @@ pub async fn list_random(ctx: &Context, msg: &Message, args: Args) -> CommandRes
|
|||||||
let line_msg = format!("* {}", resp);
|
let line_msg = format!("* {}", resp);
|
||||||
|
|
||||||
if (msg_builder.0.len() + line_msg.len()) > MESSAGE_CODE_LIMIT {
|
if (msg_builder.0.len() + line_msg.len()) > MESSAGE_CODE_LIMIT {
|
||||||
msg.channel_id.say(&ctx.http, msg_builder.build()).await?;
|
dm_channel.say(&ctx.http, msg_builder.build()).await?;
|
||||||
msg_builder.0.clear();
|
msg_builder.0.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,7 +187,7 @@ pub async fn list_random(ctx: &Context, msg: &Message, args: Args) -> CommandRes
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !msg_builder.0.is_empty() {
|
if !msg_builder.0.is_empty() {
|
||||||
msg.channel_id.say(&ctx.http, msg_builder.build()).await?;
|
dm_channel.say(&ctx.http, msg_builder.build()).await?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
msg.reply(
|
msg.reply(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user