-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
136 changed files
with
6,215 additions
and
2,342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package api | ||
|
||
import "errors" | ||
|
||
// errors returned when no gateway or ws conn exists | ||
var ( | ||
ErrNoGateway = errors.New("no gateway initialized") | ||
ErrNoGatewayConn = errors.New("no active gateway connection found") | ||
) | ||
|
||
// AudioController lets you Connect / Disconnect from a VoiceChannel | ||
type AudioController interface { | ||
Disgo() Disgo | ||
Connect(guildID Snowflake, channelID Snowflake) error | ||
Disconnect(guildID Snowflake) error | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package api | ||
|
||
// CacheFlags are used to enable/disable certain internal caches | ||
type CacheFlags int | ||
|
||
// values for CacheFlags | ||
const ( | ||
CacheFlagsNone CacheFlags = 0 | ||
CacheFlagDMChannels CacheFlags = 1 << iota | ||
CacheFlagCategories | ||
CacheFlagTextChannels | ||
CacheFlagVoiceChannels | ||
CacheFlagStoreChannels | ||
CacheFlagRoles | ||
CacheFlagEmotes | ||
CacheFlagVoiceState | ||
CacheFlagCommands | ||
CacheFlagCommandPermissions | ||
|
||
CacheFlagsDefault = CacheFlagDMChannels | | ||
CacheFlagCategories | | ||
CacheFlagTextChannels | | ||
CacheFlagVoiceChannels | | ||
CacheFlagStoreChannels | | ||
CacheFlagRoles | | ||
CacheFlagEmotes | ||
) | ||
|
||
// Add allows you to add multiple bits together, producing a new bit | ||
func (c CacheFlags) Add(bits ...Bit) Bit { | ||
total := CacheFlags(0) | ||
for _, bit := range bits { | ||
total |= bit.(CacheFlags) | ||
} | ||
c |= total | ||
return c | ||
} | ||
|
||
// Remove allows you to subtract multiple bits from the first, producing a new bit | ||
func (c CacheFlags) Remove(bits ...Bit) Bit { | ||
total := CacheFlags(0) | ||
for _, bit := range bits { | ||
total |= bit.(CacheFlags) | ||
} | ||
c &^= total | ||
return c | ||
} | ||
|
||
// HasAll will ensure that the bit includes all of the bits entered | ||
func (c CacheFlags) HasAll(bits ...Bit) bool { | ||
for _, bit := range bits { | ||
if !c.Has(bit) { | ||
return false | ||
} | ||
} | ||
return true | ||
} | ||
|
||
// Has will check whether the Bit contains another bit | ||
func (c CacheFlags) Has(bit Bit) bool { | ||
return (c & bit.(CacheFlags)) == bit | ||
} | ||
|
||
// MissingAny will check whether the bit is missing any one of the bits | ||
func (c CacheFlags) MissingAny(bits ...Bit) bool { | ||
for _, bit := range bits { | ||
if !c.Has(bit) { | ||
return true | ||
} | ||
} | ||
return false | ||
} | ||
|
||
// Missing will do the inverse of Bit.Has | ||
func (c CacheFlags) Missing(bit Bit) bool { | ||
return !c.Has(bit) | ||
} |
Oops, something went wrong.