feat: Rust 2024 kernel (serenity 0.12.5+poise 0.7, sqlx 0.9, tokio 1.53) - OTHER + roles without emojis, verify auto on boot, i18n EN, welcome 40, tickets, voice temp, fmt/clippy 0, userbot inspect
This commit is contained in:
parent
c3b0c2f976
commit
a2b2c41654
124 changed files with 1596 additions and 2896 deletions
25
src/feature/ticket/command.rs
Normal file
25
src/feature/ticket/command.rs
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use crate::feature::Ctx;
|
||||
use crate::util::i18n::{self, Lang};
|
||||
use poise::CreateReply;
|
||||
use serenity::all::{CreateActionRow, CreateButton, CreateEmbed};
|
||||
|
||||
/// /ticket-panel - panel with buttons in #open-ticket.
|
||||
#[poise::command(slash_command, prefix_command, guild_only)]
|
||||
pub async fn ticket_panel(ctx: Ctx<'_>) -> anyhow::Result<()> {
|
||||
let lang = if let Some(member) = ctx.author_member().await {
|
||||
let ids: Vec<u64> = member.roles.iter().map(|r| r.get()).collect();
|
||||
i18n::from_roles(&ids)
|
||||
} else {
|
||||
Lang::En
|
||||
};
|
||||
let embed = CreateEmbed::new()
|
||||
.title(i18n::t("ticket.title", lang))
|
||||
.description(i18n::t("ticket.desc", lang))
|
||||
.color(0x0058_65F2);
|
||||
let row = CreateActionRow::Buttons(vec![
|
||||
CreateButton::new("ticket_general").label("General").emoji('🛠'),
|
||||
CreateButton::new("ticket_bug").label("Bug").emoji('🐛'),
|
||||
]);
|
||||
ctx.send(CreateReply::default().embed(embed).components(vec![row])).await?;
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue