Bots
Création, authentification, commandes, gestion dans les serveurs et certification officielle.
CRUD Bots — /api/bots
/api/bots/meLister vos bots (JWT requis)
/api/botsCréer — body: { name, prefix, description?, isPublic? }
/api/bots/:idDétails d'un bot (public si isPublic=true)
/api/bots/:idModifier — body: { name?, prefix?, description?, isPublic?, tags? }
/api/bots/:idSupprimer le bot et révoquer son token
/api/bots/publicAnnuaire des bots publics — query: search, tag, page
Auth & Token
/api/bots/authenticateAuthentifier le bot — header: Authorization: Bot <token> → infos bot
/api/bots/:id/regenerate-tokenRégénérer un nouveau token (invalide l'ancien immédiatement)
/api/bots/:id/statusChanger le statut — body: { status: 'online'|'offline'|'maintenance' }
const res = await fetch('https://gateway.alfychat.app/api/bots/authenticate', {
method: 'POST',
headers: { 'Authorization': `Bot ${process.env.BOT_TOKEN}` },
});
const { bot } = await res.json();
console.log('Bot:', bot.name, '| prefix:', bot.prefix);Commandes — /api/bots/:id/commands
/api/bots/:id/commandsLister les commandes enregistrées
/api/bots/:id/commandsCréer — body: { name, description, cooldown?, options? }
/api/bots/:id/commands/:cmdIdModifier une commande
/api/bots/:id/commands/:cmdIdSupprimer une commande
Bots dans les serveurs
/api/bots/servers/:serverIdBots installés dans un serveur
/api/bots/:id/serversAjouter le bot dans un serveur — body: { serverId }
/api/bots/:id/servers/:serverIdRetirer le bot d'un serveur
Certification
/api/bots/:id/certificationSoumettre une demande de certification
/api/bots/certification/pendingDemandes en attente (admin uniquement)
/api/bots/certification/:reqId/reviewApprouver/refuser — body: { approved: boolean, reason? } (admin)
Badge de certification