fix: use discordgo fork, complete lavalink handshake
this works.
This commit is contained in:
parent
89c44fb63c
commit
566c1b0777
|
@ -5,12 +5,12 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"strconv"
|
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/foxbot/gavalink"
|
"github.com/foxbot/gavalink"
|
||||||
|
|
||||||
"github.com/bwmarrin/discordgo"
|
// this requires the "feature/manual-voice-connection branch!!"
|
||||||
|
"github.com/foxbot/discordgo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var token string
|
var token string
|
||||||
|
@ -33,6 +33,7 @@ func main() {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
dg.SyncEvents = false
|
||||||
|
|
||||||
dg.AddHandler(ready)
|
dg.AddHandler(ready)
|
||||||
dg.AddHandler(messageCreate)
|
dg.AddHandler(messageCreate)
|
||||||
|
@ -87,7 +88,7 @@ func messageCreate(s *discordgo.Session, m *discordgo.MessageCreate) {
|
||||||
for _, vs := range g.VoiceStates {
|
for _, vs := range g.VoiceStates {
|
||||||
if vs.UserID == m.Author.ID {
|
if vs.UserID == m.Author.ID {
|
||||||
log.Println("trying to connect to channel")
|
log.Println("trying to connect to channel")
|
||||||
_, err := s.ChannelVoiceJoin(c.GuildID, vs.ChannelID, false, false)
|
err = s.ChannelVoiceJoinManual(c.GuildID, vs.ChannelID, false, false)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
} else {
|
} else {
|
||||||
|
@ -125,10 +126,9 @@ func voiceServerUpdate(s *discordgo.Session, event *discordgo.VoiceServerUpdate)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
gid, _ := strconv.Atoi(event.GuildID)
|
|
||||||
vsu := gavalink.VoiceServerUpdate{
|
vsu := gavalink.VoiceServerUpdate{
|
||||||
Endpoint: event.Endpoint,
|
Endpoint: event.Endpoint,
|
||||||
GuildID: gid,
|
GuildID: event.GuildID,
|
||||||
Token: event.Token,
|
Token: event.Token,
|
||||||
}
|
}
|
||||||
handler := new(gavalink.DummyEventHandler)
|
handler := new(gavalink.DummyEventHandler)
|
||||||
|
@ -137,6 +137,4 @@ func voiceServerUpdate(s *discordgo.Session, event *discordgo.VoiceServerUpdate)
|
||||||
log.Println(err)
|
log.Println(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
panic("discordgo: cancel event")
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue