Skip to content

Commit

Permalink
画像も送信可能にした
Browse files Browse the repository at this point in the history
  • Loading branch information
tuna2134 committed Sep 5, 2023
1 parent e0b4ef5 commit a7578c8
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,14 @@ async fn handle_event(
)
}
let image_source = ImageSource::url(avatar_url)?;
let embed = EmbedBuilder::new()
let mut embed = EmbedBuilder::new()
.description(&msg.content)
.author(EmbedAuthorBuilder::new(msg.author.name.clone()).icon_url(image_source))
.timestamp(msg.timestamp)
.build();
.timestamp(msg.timestamp);
if !msg.attachments.is_empty() {
embed = embed.image(ImageSource::url(msg.attachments[0].url.clone())?);
}
let embed = embed.build();
client
.http
.create_message(channel_id)
Expand All @@ -168,14 +171,17 @@ async fn handle_event(
guild.id(),
guild.icon().unwrap()
);
let embed = EmbedBuilder::new()
let mut embed = EmbedBuilder::new()
.description(&msg.content)
.author(
EmbedAuthorBuilder::new("運営(Moderator)")
.icon_url(ImageSource::url(icon_url)?),
)
.timestamp(msg.timestamp)
.build();
.timestamp(msg.timestamp);
if !msg.attachments.is_empty() {
embed = embed.image(ImageSource::url(msg.attachments[0].url.clone())?);
}
let embed = embed.build();
client
.http
.create_message(channel.id)
Expand Down

0 comments on commit a7578c8

Please sign in to comment.