From ac6bd108da91623c2993dcdd95fc490a94f397d8 Mon Sep 17 00:00:00 2001 From: Joey Hines Date: Wed, 18 Jan 2023 19:31:59 -0700 Subject: [PATCH] Send random_list to a user's dms + just fmt still --- src/discord/joke.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/discord/joke.rs b/src/discord/joke.rs index bac1f66..17b8581 100644 --- a/src/discord/joke.rs +++ b/src/discord/joke.rs @@ -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 dm_channel = msg.author.id.create_dm_channel(&ctx.http).await?; if let Some(random) = random { let mut msg_builder = MessageBuilder::new(); 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); 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(); } @@ -186,7 +187,7 @@ pub async fn list_random(ctx: &Context, msg: &Message, args: Args) -> CommandRes } 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 { msg.reply(