smol bot
add slightly more logging to find rare bug
bendn 2 months ago
parent 7bb7e3e · commit 4dbce5d
-rw-r--r--src/bot/mod.rs5
-rw-r--r--src/bot/schematic.rs3
2 files changed, 5 insertions, 3 deletions
diff --git a/src/bot/mod.rs b/src/bot/mod.rs
index 01d0074..13416e0 100644
--- a/src/bot/mod.rs
+++ b/src/bot/mod.rs
@@ -279,10 +279,12 @@ async fn handle_message(
..m.clone()
};
if x.is_continue() {
+ println!("schematic with; forward");
x = schematic::with(m, c, l.clone()).await?;
};
}
if x.is_continue() {
+ println!("schematic with; attached");
x = schematic::with(m, c, l).await?;
}
match x {
@@ -467,7 +469,7 @@ impl Bot {
}).map(|x| x.name.clone()).collect::<Vec<_>>();
EXTRA.insert(thread.id.get(), Ch { repo, d, ty: Type::Owned(tg) });
}
- FullEvent::MessageUpdate {event: MessageUpdateEvent {
+ FullEvent::MessageUpdate {old_if_available, new, event:e@ MessageUpdateEvent {
author: Some(author),
guild_id: Some(guild_id),
content: Some(content),
@@ -483,6 +485,7 @@ impl Bot {
.await
.unwrap_or(author.name.clone());
let (dir, l, repo) = sep(SPECIAL.get(&r.channel_id.get()));
+ println!("schematic with; edit ({old_if_available:?} {new:?} {e:?})");
if let ControlFlow::Break((m,_,s)) = schematic::with(
Msg {
locale:author.locale.clone().unwrap_or("unknown locale".to_string()),
diff --git a/src/bot/schematic.rs b/src/bot/schematic.rs
index ea863c1..63a96af 100644
--- a/src/bot/schematic.rs
+++ b/src/bot/schematic.rs
@@ -113,10 +113,9 @@ pub async fn send(
v: Schem,
) -> Result<(poise::serenity_prelude::Message, std::string::String, Schem)> {
let name = emoji::mindustry::to_discord(&strip_colors(v.tags.get("name").unwrap()));
- println!("deser {name}");
let vclone = v.clone();
+ println!("rend {name} (shard# {})", c.shard_id.0);
let p = tokio::task::spawn_blocking(move || to_png(&vclone)).await?;
- println!("rend {name}");
let msg = CreateMessage::new()
.add_file(CreateAttachment::bytes(p, "image.png"))
.embed(e(&m.author, &m.avatar, &v).title(name.clone()));