fix(help): re-attach banner on Overview update; keep ticket handler within 200 lines
This commit is contained in:
parent
6ca874d113
commit
ee43b32ed8
2 changed files with 14 additions and 16 deletions
|
|
@ -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()
|
||||
.embed(embed)
|
||||
.components(components()),
|
||||
),
|
||||
)
|
||||
.await;
|
||||
let mut msg = serenity::all::CreateInteractionResponseMessage::new()
|
||||
.embed(embed)
|
||||
.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.
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue