1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-03-26 20:09:37 +00:00

API: Fixed UserRateLimit 0 and omitempty

This commit is contained in:
diamondburned (Forefront) 2020-04-08 17:48:36 -07:00
parent 6dafb30401
commit bd32b19645
2 changed files with 8 additions and 4 deletions

View file

@ -85,8 +85,8 @@ type ModifyChannelData struct {
Topic json.OptionString `json:"topic,omitempty"`
NSFW json.OptionBool `json:"nsfw,omitempty"`
// 0-21600, refer to Channel.UserRateLimit
UserRateLimit discord.Seconds `json:"rate_limit_per_user,omitempty"`
// 0-21600 seconds, refer to (discord.Channel).UserRateLimit.
UserRateLimit json.OptionInt `json:"rate_limit_per_user,omitempty"`
// Voice only
// 8000 - 96000 (or 128000 for Nitro)

View file

@ -112,9 +112,13 @@ func (h *Handler) ChanFor(fn func(interface{}) bool) (out <-chan interface{}, ca
}
})
// Only allow cancel to be called once.
var once sync.Once
cancel = func() {
removeHandler()
close(closer)
once.Do(func() {
removeHandler()
close(closer)
})
}
out = result