fix: correctly find slice_end

This commit is contained in:
oSumAtrIX 2023-01-06 05:22:49 +01:00
parent f754cd3107
commit 7e2db945a0
No known key found for this signature in database
GPG Key ID: A9B3094ACDB604B4

View File

@ -21,7 +21,7 @@ pub async fn handle_code_url(ctx: &serenity::Context, new_message: &serenity::Me
if let Some(end) = new_slice if let Some(end) = new_slice
.find(' ') .find(' ')
.or_else(|| new_slice.find('\n')) .or(Some(new_slice.len()))
.map(|slice_end| start + slice_end) .map(|slice_end| start + slice_end)
{ {
debug!("HTTP url end: {}", end); debug!("HTTP url end: {}", end);
@ -72,7 +72,7 @@ pub async fn handle_code_url(ctx: &serenity::Context, new_message: &serenity::Me
for code_preview in code_previews { for code_preview in code_previews {
message = message.add_embed(|e| { message = message.add_embed(|e| {
let mut e = e let mut e = e
.title("Code preview") .title("Source code")
.url(code_preview.code.original_code_url) .url(code_preview.code.original_code_url)
.color(configuration.general.embed_color) .color(configuration.general.embed_color)
.field( .field(