ILLEST Developers

Rate limits

Every account has a bucket per action. A bucket holds burst requests, and refills at its rate, in requests a second. A request that finds its bucket empty is refused with RATE_LIMITED before anything is done. A bot is an account, so it has buckets of its own, separate from its owner's.

What the library does about it

illest.py keeps the same buckets on its side and waits for a token before it sends, so a bot that sends in a loop is slowed, not refused. The two can still disagree (another copy of the bot running on the same account, or a restart with full buckets on the bot's side and empty ones on the server's). A refused request is sent again after the time its bucket needs, three times, and only then raised:

Python
import illest


async def announce(channel: illest.TextChannel, text: str):
    try:
        await channel.send(text)
    except illest.RateLimited as error:
        print(f"try again in {error.retry_after} seconds")

retry_after is the server's figure when it gave one, otherwise the action's published rate.

The limits

Every action a bot may send, with its bucket. An action without a limit of its own takes the default, 10 at once, then 2 a second. The library is built against these numbers; a server that changes them is waited out by the retry.

ActionAt onceThen, a second
auth.credential101
auth.device.list102
auth.device.rename102
auth.device.revoke102
auth.login.begin51
auth.login.complete51
auth.login.verify51
auth.logout102
auth.recover.begin51
auth.recover.complete30.5
auth.recover.verify30.2
auth.register.begin30.2
auth.register.cancel102
auth.register.complete51
auth.register.work50.5
auth.release50.5
auth.reset.begin51
auth.reset.complete30.2
auth.session.revoke_all102
auth.unpark50.5
badge.list102
bot.commands.get202
bot.commands.set50.5
bot.identify101
bot.identity.publish51
bot.info202
channel.devices408
channel.disappear.set6010
channel.dm.open101
channel.get408
channel.group.leave6010
channel.hide102
channel.list102
channel.messages.clear102
channel.messages.list408
channel.messages.purge3010
channel.pins.list102
channel.read102
channel.topic.set102
channel.typing106
channel.unread102
commands.index202
friend.accept102
friend.block102
friend.blocked102
friend.list102
friend.reject102
friend.remove102
friend.request100.5
friend.unblock102
guild.application.decide102
guild.application.form.get102
guild.application.get102
guild.application.list102
guild.audit104
guild.automod.event.settle205
guild.automod.events102
guild.automod.get202
guild.automod.lockdown51
guild.automod.raid.remove51
guild.ban102
guild.bans102
guild.boosts102
guild.category.create102
guild.category.delete102
guild.category.permissions102
guild.category.permissions.set102
guild.category.reorder102
guild.category.update102
guild.channel.create102
guild.channel.delete102
guild.channel.follow50.5
guild.channel.lock102
guild.channel.permissions102
guild.channel.permissions.set102
guild.channel.published51
guild.channel.reorder102
guild.channel.unfollow50.5
guild.channel.update102
guild.counter.add50.5
guild.counter.remove50.5
guild.counter.set51
guild.expression.create102
guild.expression.delete102
guild.expression.list102
guild.expression.update102
guild.follows.list51
guild.get102
guild.giveaway.cancel50.5
guild.giveaway.end50.5
guild.giveaway.list51
guild.giveaway.reroll50.5
guild.giveaway.start50.2
guild.invite.create202
guild.invite.list102
guild.invite.preview203
guild.invite.revoke102
guild.invites.joins51
guild.join302
guild.kick102
guild.leave102
guild.levels.get102
guild.levels.list51
guild.levels.reset102
guild.line.delete305
guild.lines.list51
guild.list102
guild.members153
guild.message.publish101
guild.message.unpublish101
guild.onboarding.get102
guild.onboarding.preview203
guild.overrides104
guild.overrides.all62
guild.profile.get153
guild.profile.set102
guild.role.assign102
guild.role.create102
guild.role.delete102
guild.role.reorder102
guild.role.update102
guild.rules.get102
guild.rules.let_in102
guild.rules.set102
guild.timeout102
guild.unban102
guild.vanity.resolve303
guild.warn305
guild.warning.delete305
guild.warnings153
identity.certify51
identity.get102
identity.publish51
link.preview100.5
media.fetch201
media.ticket101
message.pin3010
message.redact3010
message.send205
message.unpin3010
mls.commit.submit205
mls.commits.since6012
mls.grant.clear51
mls.grant.issue205
mls.grant.needed6012
mls.group.reset20.2
mls.group.roster102
mls.group_info.get102
mls.group_info.publish205
mls.key_packages.claim306
mls.key_packages.count102
mls.key_packages.publish51
mls.key_packages.purge51
mls.welcomes.ack102
mls.welcomes.pending102
name.available202
name.resolve202
pins.get202
pins.put100.5
presence.set51
user.get204
user.update102
voice.member.deafen124
voice.member.disconnect124
voice.member.move124
voice.member.mute124
voice.states102

Being a good citizen

  • Send one message with several lines rather than several messages.
  • Edit a status message rather than posting a new one each minute.
  • A task that runs on a timer (ext.tasks.loop) should run as often as its answer changes, and no more.