HTTP 420 · Flood
FLOOD_WAIT_X
Please wait %v seconds before repeating the action.
HTTP 420
Flood / Rate limits
Parameterized
When & why it happens
Too many requests in too short a window. Wait the supplied number of seconds before retrying; the gogram client schedules this automatically.
Parameterized error
The wire code carries a parameter on its tail (literal you'll see: FLOOD_WAIT_42). Gogram parses it out and stores it on ErrResponseCode.AdditionalInfo with the right type.
Handling in gogram
Surfaced as *gogram.ErrResponseCode. Match on the message:
if err, ok := err.(*gogram.ErrResponseCode); ok {
if strings.HasPrefix(err.Message, "FLOOD_WAIT") {
secs := err.AdditionalInfo.(int)
time.Sleep(time.Duration(secs) * time.Second)
// retry
}
}
Related errors
ADMINS_TOO_MUCHThere are too many admins.BOTS_TOO_MUCHThere are too many bots in this chat/channel.BOT_COMMANDS_TOO_MUCHThe provided commands are too many.CHANNELS_ADMIN_LOCATED_TOO_MUCHThe user has reached the limit of public geogroups.CHANNELS_ADMIN_PUBLIC_TOO_MUCHYou're admin of too many public channels, make some channels private to change the username of this channel.CHANNELS_TOO_MUCHYou have joined too many channels/supergroups.FLOOD_PREMIUM_WAIT_XA wait of %v seconds is required before calling the method.FLOOD_TEST_PHONE_WAIT_XA wait of %v seconds is required in the test servers.INVITES_TOO_MUCHThe maximum number of per-folder invites was reached.OPTIONS_TOO_MUCHToo many options provided.PINNED_DIALOGS_TOO_MUCHToo many pinned dialogs.QUIZ_CORRECT_ANSWERS_TOO_MUCHYou specified too many correct answers in a quiz, quizzes can only have one right answer!