1
0
mirror of https://github.com/stryan/mumble-discord-bridge.git synced 2024-12-28 17:15:40 -05:00

use string slice for mumble channel

This commit is contained in:
stryan 2021-02-08 13:16:09 -05:00
parent 7094f71f43
commit bcf0b30d1e
3 changed files with 9 additions and 9 deletions

View File

@ -24,7 +24,7 @@ type BridgeConfig struct {
MumbleConfig *gumble.Config
MumbleAddr string
MumbleInsecure bool
MumbleChannel string
MumbleChannel []string
MumbleDisableText bool
Command string
GID string

View File

@ -8,6 +8,7 @@ import (
"os/signal"
"runtime/pprof"
"strconv"
"strings"
"syscall"
"time"
@ -99,7 +100,7 @@ func main() {
// MumbleConfig: config,
MumbleAddr: *mumbleAddr + ":" + strconv.Itoa(*mumblePort),
MumbleInsecure: *mumbleInsecure,
MumbleChannel: *mumbleChannel,
MumbleChannel: strings.Split(*mumbleChannel, "/"),
MumbleDisableText: *mumbleDisableText,
Command: *discordCommand,
GID: *discordGID,

View File

@ -1,6 +1,7 @@
package main
import (
"fmt"
"log"
"strings"
@ -13,12 +14,10 @@ type MumbleListener struct {
}
func (l *MumbleListener) mumbleConnect(e *gumble.ConnectEvent) {
if l.Bridge.BridgeConfig.MumbleChannel != "" {
//join specified channel
startingChannel := e.Client.Channels.Find(l.Bridge.BridgeConfig.MumbleChannel)
if startingChannel != nil {
e.Client.Self.Move(startingChannel)
}
//join specified channel
startingChannel := e.Client.Channels.Find(l.Bridge.BridgeConfig.MumbleChannel...)
if startingChannel != nil {
e.Client.Self.Move(startingChannel)
}
}
@ -42,7 +41,7 @@ func (l *MumbleListener) mumbleUserChange(e *gumble.UserChangeEvent) {
log.Println("User connected to mumble " + e.User.Name)
if !l.Bridge.BridgeConfig.MumbleDisableText {
e.User.Send("Mumble-Discord-Bridge v" + version)
e.User.Send(fmt.Sprintf("Mumble-Discord-Bridge %v", version))
// Tell the user who is connected to discord
if len(l.Bridge.DiscordUsers) == 0 {