smol bot
bendn 2024-01-21
parent e305dec · commit 261ebbb
-rw-r--r--src/bot/mod.rs3
-rw-r--r--src/bot/schematic.rs5
2 files changed, 7 insertions, 1 deletions
diff --git a/src/bot/mod.rs b/src/bot/mod.rs
index 9cf0d55..3ddc0e6 100644
--- a/src/bot/mod.rs
+++ b/src/bot/mod.rs
@@ -27,6 +27,7 @@ pub struct Data {
}
pub struct Msg {
+ avatar: String,
author: String,
content: String,
channel: ChannelId,
@@ -347,6 +348,7 @@ impl Bot {
.unwrap_or(new_message.author.name.clone());
let m = Msg {
author: who.clone(),
+ avatar: new_message. author.avatar_url().unwrap_or(CAT.to_string()),
attachments: new_message.attachments.clone(),
content: new_message.content.clone(),
channel: new_message.channel_id,
@@ -393,6 +395,7 @@ impl Bot {
.unwrap_or(author.name.clone());
if let ControlFlow::Break((m,_,s)) = schematic::with(
Msg {
+ avatar: author.avatar_url().unwrap_or(CAT.to_string()),
author: who.clone(),
content:content.clone(),
attachments:attachments.clone(),
diff --git a/src/bot/schematic.rs b/src/bot/schematic.rs
index 11436b8..c79ac90 100644
--- a/src/bot/schematic.rs
+++ b/src/bot/schematic.rs
@@ -121,7 +121,10 @@ pub async fn with(
}
e.field("req", s, true)
.title(name.clone())
- .footer(CreateEmbedFooter::new(format!("requested by {author}")))
+ .footer(
+ CreateEmbedFooter::new(format!("requested by {author}"))
+ .icon_url(m.avatar),
+ )
.color(SUCCESS)
}),
)