mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-08 13:07:43 +00:00
Voice: Rename NewVoice... to New
This commit is contained in:
parent
0d427cab71
commit
1463d6e675
|
@ -30,7 +30,7 @@ func TestIntegration(t *testing.T) {
|
|||
log.Println(append([]interface{}{caller}, v...)...)
|
||||
}
|
||||
|
||||
v, err := NewVoiceFromToken("Bot " + config.BotToken)
|
||||
v, err := NewFromToken("Bot " + config.BotToken)
|
||||
if err != nil {
|
||||
t.Fatal("Failed to create a new voice session:", err)
|
||||
}
|
||||
|
|
|
@ -40,31 +40,31 @@ type Voice struct {
|
|||
ErrorLog func(err error)
|
||||
}
|
||||
|
||||
// NewVoiceFromToken creates a new voice session from the given token.
|
||||
func NewVoiceFromToken(token string) (*Voice, error) {
|
||||
// NewFromToken creates a new voice session from the given token.
|
||||
func NewFromToken(token string) (*Voice, error) {
|
||||
s, err := state.New(token)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "failed to create a new session")
|
||||
}
|
||||
|
||||
return NewVoice(s), nil
|
||||
return New(s), nil
|
||||
}
|
||||
|
||||
// NewVoice creates a new Voice repository wrapped around a state. The function
|
||||
// will also automatically add the GuildVoiceStates intent, as that is required.
|
||||
// New creates a new Voice repository wrapped around a state. The function will
|
||||
// also automatically add the GuildVoiceStates intent, as that is required.
|
||||
//
|
||||
// This function will add the Guilds and GuildVoiceStates intents into the state
|
||||
// in order to receive the needed events.
|
||||
func NewVoice(s *state.State) *Voice {
|
||||
func New(s *state.State) *Voice {
|
||||
// Register the voice intents.
|
||||
s.Gateway.AddIntents(gateway.IntentGuilds)
|
||||
s.Gateway.AddIntents(gateway.IntentGuildVoiceStates)
|
||||
return NewVoiceWithoutIntents(s)
|
||||
return NewWithoutIntents(s)
|
||||
}
|
||||
|
||||
// NewVoice creates a new Voice repository wrapped around a state without
|
||||
// modifying the given Gateway to add intents.
|
||||
func NewVoiceWithoutIntents(s *state.State) *Voice {
|
||||
// NewWithoutIntents creates a new Voice repository wrapped around a state
|
||||
// without modifying the given Gateway to add intents.
|
||||
func NewWithoutIntents(s *state.State) *Voice {
|
||||
v := &Voice{
|
||||
State: s,
|
||||
sessions: make(map[discord.GuildID]*Session),
|
||||
|
|
Loading…
Reference in a new issue