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