Skip to content

Commit a752043

Browse files
committed
Use embed for udev command
1 parent e2ec6dd commit a752043

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/commands/udev.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
use crate::commands::OK_COLOUR;
12
use crate::{Context, Error};
23

34
use std::fmt::Write;
45

5-
use poise::serenity_prelude::CreateAttachment;
6+
use poise::serenity_prelude::{CreateAttachment, CreateEmbed};
67
use poise::CreateReply;
78

89
/// Generates udev rules for the given vendor and product Ids.
@@ -21,15 +22,17 @@ pub async fn generate_udev(
2122
let udev = gen_udev(vendor_id, product_id, libinput_override.unwrap_or(true));
2223

2324
let attachment = CreateAttachment::bytes(udev, "70-opentabletdriver.rules");
24-
ctx.send(
25-
CreateReply::default()
26-
.content(
27-
"place this file in `/etc/udev/rules.d/70-opentabletdriver.rules` then run the \
28-
following: \n```sudo udevadm control --reload-rules && sudo udevadm trigger\n```",
29-
)
30-
.attachment(attachment),
31-
)
32-
.await?;
25+
let embed = CreateEmbed::new()
26+
.title("Generated Udev rules")
27+
.description(
28+
"Move this file to `/etc/udev/rules.d/70-opentabletdriver.rules` then run the \
29+
following commands: \n```sudo udevadm control --reload-rules && sudo udevadm \
30+
trigger\n```",
31+
)
32+
.color(OK_COLOUR);
33+
34+
ctx.send(CreateReply::default().embed(embed).attachment(attachment))
35+
.await?;
3336

3437
Ok(())
3538
}

0 commit comments

Comments
 (0)