Compare commits
2 Commits
new/vc-sup
...
main
Author | SHA1 | Date | |
---|---|---|---|
6504336d01 | |||
a310fd4533 |
28
bolt.go
28
bolt.go
@ -1,7 +1,6 @@
|
|||||||
package bolt
|
package bolt
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
@ -44,7 +43,6 @@ type Bolt interface {
|
|||||||
getRemainingTimeout(timeout time.Time) string
|
getRemainingTimeout(timeout time.Time) string
|
||||||
roleCheck(guild string, roles []string, s *dg.Session, run Command) (bool, error)
|
roleCheck(guild string, roles []string, s *dg.Session, run Command) (bool, error)
|
||||||
timeoutCheck(msgID, channelID, guildID string, s *dg.Session, run Command) (bool, error)
|
timeoutCheck(msgID, channelID, guildID string, s *dg.Session, run Command) (bool, error)
|
||||||
joinUserVoice(guild, user string, s *dg.Session) (*dg.VoiceConnection, error)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// create a new bolt interface
|
// create a new bolt interface
|
||||||
@ -330,29 +328,3 @@ func (b *bolt) timeoutCheck(msgID, channelID, guildID string, s *dg.Session, run
|
|||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (b *bolt) joinUserVoice(guild, user string, s *dg.Session) (*dg.VoiceConnection, error) {
|
|
||||||
g, err := s.State.Guild(guild)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
var chanID string
|
|
||||||
for _, x := range g.VoiceStates {
|
|
||||||
if user == x.UserID {
|
|
||||||
chanID = x.ChannelID
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if chanID == "" {
|
|
||||||
return nil, errors.New("user is not in a voice channel")
|
|
||||||
}
|
|
||||||
|
|
||||||
//joining voice channel: false = not muted, true = deafened
|
|
||||||
dgv, err := s.ChannelVoiceJoin(guild, chanID, false, true)
|
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return dgv, nil
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user