registerServer method
Implementation
@override
Future<void> registerServer(Bot bot, Guild guild) async {
final List<CommandBuilder> guildCommands = _getContext(
CommandContextType.guild,
);
final payload = _serializeCommand(guildCommands);
final req = Request.json(
endpoint: '/applications/${bot.id}/guilds/${guild.id}/commands',
body: payload,
);
// `registerServer` runs once per GUILD_CREATE, so a bot in N guilds
// fires N PUTs at startup: routing through the bucket (instead of
// `_dataStore.client` directly) throttles that burst, and any
// non-success status (401/403/429/5xx — not just 400) raises instead of
// completing as a silent success (#470).
await _dataStore.requestBucket.put<dynamic>(
req,
onError: (response) =>
_registrationFailure(response, scope: 'guild ${guild.id}'),
);
}