1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2024-11-05 06:26:08 +00:00
arikawa/discord/discord.go
diamondburned 6aefc34992
discord: Add field Proxy into Video
Also added some useful comments in relevant files and moved
OverboundError to discord.go.

See https://discord.com/developers/docs/resources/channel#embed-object-embed-video-structure
2022-04-08 03:35:20 -07:00

32 lines
829 B
Go

// Package discord provides common structures that the whole repository uses. It
// does not (and should not) contain API-specific structures, or WS-specific
// structures.
package discord
import "fmt"
// HasFlag is returns true if has is in the flag. In other words, it checks if
// has is OR'ed into flag. This function could be used for different constants
// such as Permission.
func HasFlag(flag, has uint64) bool {
return flag&has == has
}
// OverboundError is an error that's returned if any value is too long.
type OverboundError struct {
Count int
Max int
Thing string
}
var _ error = (*OverboundError)(nil)
func (e *OverboundError) Error() string {
if e.Thing == "" {
return fmt.Sprintf("Overbound error: %d > %d", e.Count, e.Max)
}
return fmt.Sprintf(e.Thing+" overbound: %d > %d", e.Count, e.Max)
}