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. /// Handles `help:category` select. Edits the original help message.
pub async fn on_select(ctx: Context, interaction: ComponentInteraction) { 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() { let embed = match interaction.data.custom_id.as_str() {
"help:home" => main_embed("!", &interaction.user.name, None), "help:home" => main_embed("!", &interaction.user.name, None),
"help:category" => { "help:category" => {
@ -136,17 +139,14 @@ pub async fn on_select(ctx: Context, interaction: ComponentInteraction) {
} }
_ => return, _ => return,
}; };
// Edit original message via UpdateMessage response let mut msg = serenity::all::CreateInteractionResponseMessage::new()
let _ = interaction .embed(embed)
.create_response( .components(components());
&ctx.http, if home {
CreateInteractionResponse::UpdateMessage( msg = msg.add_file(brand::Banner::Help.attachment());
serenity::all::CreateInteractionResponseMessage::new() }
.embed(embed) let _ =
.components(components()), interaction.create_response(&ctx.http, CreateInteractionResponse::UpdateMessage(msg)).await;
),
)
.await;
} }
/// Helper for command.rs to build main page. /// Helper for command.rs to build main page.

View file

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