added signaling for owner/mod commands

This commit is contained in:
nin0dev 2024-09-23 21:13:47 -04:00
parent 3e1f1ee82e
commit 43d9fe5cfc
Signed by: nin0
GPG key ID: 3FA8F96ABAE04214

View file

@ -10,13 +10,13 @@ async function handler(ctx: Context, args: string[]) {
`*${cmd.name}${cmd.aliases.length ? ` (${cmd.aliases.join(", ")})` : ""}*\n${cmd.description}\n${cmd.modOnly ? "_🛡 Mod only_" : ""}${cmd.ownerOnly ? "_👑 Owner only_" : ""}` `*${cmd.name}${cmd.aliases.length ? ` (${cmd.aliases.join(", ")})` : ""}*\n${cmd.description}\n${cmd.modOnly ? "_🛡 Mod only_" : ""}${cmd.ownerOnly ? "_👑 Owner only_" : ""}`
); );
} else { } else {
const cmds = commands.filter((c) => !c.ownerOnly); const cmds = commands;
cmds.sort((a, b) => a.name.localeCompare(b.name)); // Sort commands alphabetically by name cmds.sort((a, b) => a.name.localeCompare(b.name)); // Sort commands alphabetically by name
return await ctx.replyWithMarkdown( return await ctx.replyWithMarkdown(
cmds cmds
.map( .map(
(c) => (c) =>
`*${c.name}*${c.aliases.length ? `_ (${c.aliases.join(", ")})_` : ""} - ${c.description}` `*${c.name}*${c.aliases.length ? `_ (${c.aliases.join(", ")})_` : ""}${c.ownerOnly ? " 👑" : ""}${c.ownerOnly ? " 🛡️" : ""} - ${c.description}`
) )
.join("\n") .join("\n")
); );