AlfyChat
Langage :

Bots

Création, authentification, commandes, gestion dans les serveurs et certification officielle.

CRUD Bots — /api/bots

GET
/api/bots/me

Lister vos bots (JWT requis)

POST
/api/bots

Créer — body: { name, prefix, description?, isPublic? }

GET
/api/bots/:id

Détails d'un bot (public si isPublic=true)

PATCH
/api/bots/:id

Modifier — body: { name?, prefix?, description?, isPublic?, tags? }

DELETE
/api/bots/:id

Supprimer le bot et révoquer son token

GET
/api/bots/public

Annuaire des bots publics — query: search, tag, page

Auth & Token

POST
/api/bots/authenticate

Authentifier le bot — header: Authorization: Bot <token> → infos bot

POST
/api/bots/:id/regenerate-token

Régénérer un nouveau token (invalide l'ancien immédiatement)

PATCH
/api/bots/:id/status

Changer le statut — body: { status: 'online'|'offline'|'maintenance' }

Authentifier un bot
js
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

GET
/api/bots/:id/commands

Lister les commandes enregistrées

POST
/api/bots/:id/commands

Créer — body: { name, description, cooldown?, options? }

PATCH
/api/bots/:id/commands/:cmdId

Modifier une commande

DELETE
/api/bots/:id/commands/:cmdId

Supprimer une commande

Bots dans les serveurs

GET
/api/bots/servers/:serverId

Bots installés dans un serveur

POST
/api/bots/:id/servers

Ajouter le bot dans un serveur — body: { serverId }

DELETE
/api/bots/:id/servers/:serverId

Retirer le bot d'un serveur

Certification

POST
/api/bots/:id/certification

Soumettre une demande de certification

GET
/api/bots/certification/pending

Demandes en attente (admin uniquement)

POST
/api/bots/certification/:reqId/review

Approuver/refuser — body: { approved: boolean, reason? } (admin)

Badge de certification

Un bot certifié reçoit un badge ✅ visible dans l'annuaire public. La certification est manuelle et validée par l'équipe AlfyChat.