feat(web): publish the slash commands from the panel
Registering the commands was the one routine step that still needed shell access on the host, which is awkward when the bot runs behind a hosting panel. Guild commands take effect immediately, so the button says what it did as soon as it returns. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2 files changed
+68
-3
No files matched your search
@@ -4,6 +4,7 @@ import {
|
||||
badge,
|
||||
button,
|
||||
card,
|
||||
confirmAction,
|
||||
field,
|
||||
grid,
|
||||
input,
|
||||
@@ -397,8 +398,32 @@ export async function render(host, { state }) {
|
||||
notificationsCard(guild, level),
|
||||
|
||||
card(
|
||||
'Commandes',
|
||||
{ advanced: true, subtitle: 'Commandes slash chargées et niveau requis.' },
|
||||
'Commandes slash',
|
||||
{
|
||||
subtitle: 'Commandes chargées par le bot et niveau requis pour chacune.',
|
||||
actions:
|
||||
level >= LEVELS.OWNER &&
|
||||
button(
|
||||
'Publier sur Discord',
|
||||
async () => {
|
||||
if (
|
||||
!(await confirmAction(
|
||||
'Publier les commandes',
|
||||
'Les commandes chargées remplacent celles enregistrées sur le serveur. L’effet est immédiat.',
|
||||
))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
const result = await api.post('/api/discord/commands/deploy', {});
|
||||
toast(`${result.count} commande(s) publiée(s) sur le serveur.`);
|
||||
},
|
||||
{ tone: 'primary' },
|
||||
),
|
||||
},
|
||||
h('p', {
|
||||
class: 'muted',
|
||||
text: 'À relancer après chaque ajout ou modification de commande — l’équivalent de `npm run deploy:commands`.',
|
||||
}),
|
||||
await renderCommands(),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user