fix(help): re-attach banner on Overview update; keep ticket handler within 200 lines

This commit is contained in:
Loki 2026-10-21 15:33:09 +02:00
parent 6ca874d113
commit ee43b32ed8
Signed by: boba
GPG key ID: 253067914055423B
2 changed files with 14 additions and 16 deletions

View file

@ -122,6 +122,9 @@ pub fn components() -> Vec<CreateActionRow> {
/// Handles `help:category` select. Edits the original help message.
pub async fn on_select(ctx: Context, interaction: ComponentInteraction) {
// UpdateMessage always replaces attachments, so the overview re-uploads its banner;
// category pages carry no image and simply drop it.
let home = interaction.data.custom_id == "help:home";
let embed = match interaction.data.custom_id.as_str() {
"help:home" => main_embed("!", &interaction.user.name, None),
"help:category" => {
@ -136,17 +139,14 @@ pub async fn on_select(ctx: Context, interaction: ComponentInteraction) {
}
_ => return,
};
// Edit original message via UpdateMessage response
let _ = interaction
.create_response(
&ctx.http,
CreateInteractionResponse::UpdateMessage(
serenity::all::CreateInteractionResponseMessage::new()
let mut msg = serenity::all::CreateInteractionResponseMessage::new()
.embed(embed)
.components(components()),
),
)
.await;
.components(components());
if home {
msg = msg.add_file(brand::Banner::Help.attachment());
}
let _ =
interaction.create_response(&ctx.http, CreateInteractionResponse::UpdateMessage(msg)).await;
}
/// Helper for command.rs to build main page.

View file

@ -7,8 +7,8 @@ pub mod interaction;
pub use interaction::on_select;
use serenity::all::{
ChannelId, Context, CreateActionRow, CreateEmbed, CreateSelectMenu, CreateSelectMenuKind,
CreateSelectMenuOption, GuildId,
ChannelId, Context, CreateActionRow, CreateEmbed, CreateEmbedFooter, CreateSelectMenu,
CreateSelectMenuKind, CreateSelectMenuOption, GuildId,
};
use tracing::info;
@ -58,9 +58,7 @@ pub fn panel_embed() -> CreateEmbed {
• Abuse / spam → blacklist.",
)
.color(crate::util::brand::ACCENT)
.footer(serenity::all::CreateEmbedFooter::new(
"Loki Dev • Select topic → fill form → ticket created",
))
.footer(CreateEmbedFooter::new("Loki Dev • Select topic → fill form → ticket created"))
}
pub fn panel_select_row() -> CreateActionRow {