mirror of
https://github.com/stryan/mumble-discord-bridge.git
synced 2024-11-14 19:45:41 -05:00
use gumble.Client.Do for sending messages thread safely
This commit is contained in:
parent
1e8a0a4165
commit
4ae6176991
@ -114,7 +114,9 @@ func startBridge(discord *discordgo.Session, discordGID string, discordCID strin
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("error looking up username")
|
log.Println("error looking up username")
|
||||||
Bridge.DiscordUsers[u.Username] = true
|
Bridge.DiscordUsers[u.Username] = true
|
||||||
|
Bridge.Client.Do(func() {
|
||||||
Bridge.Client.Self.Channel.Send(fmt.Sprintf("%v has joined Discord channel\n", u.Username), false)
|
Bridge.Client.Self.Channel.Send(fmt.Sprintf("%v has joined Discord channel\n", u.Username), false)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,9 @@ func voiceUpdate(s *discordgo.Session, event *discordgo.VoiceStateUpdate) {
|
|||||||
}
|
}
|
||||||
log.Println("user joined watched discord channel")
|
log.Println("user joined watched discord channel")
|
||||||
if Bridge.Connected {
|
if Bridge.Connected {
|
||||||
|
Bridge.Client.Do(func() {
|
||||||
Bridge.Client.Self.Channel.Send(fmt.Sprintf("%v has joined Discord channel\n", u.Username), false)
|
Bridge.Client.Self.Channel.Send(fmt.Sprintf("%v has joined Discord channel\n", u.Username), false)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Bridge.DiscordUsers[u.Username] = true
|
Bridge.DiscordUsers[u.Username] = true
|
||||||
log.Println(Bridge.DiscordUsers)
|
log.Println(Bridge.DiscordUsers)
|
||||||
@ -184,7 +186,9 @@ func voiceUpdate(s *discordgo.Session, event *discordgo.VoiceStateUpdate) {
|
|||||||
delete(Bridge.DiscordUsers, u.Username)
|
delete(Bridge.DiscordUsers, u.Username)
|
||||||
log.Println("user left watched discord channel")
|
log.Println("user left watched discord channel")
|
||||||
if Bridge.Connected {
|
if Bridge.Connected {
|
||||||
|
Bridge.Client.Do(func() {
|
||||||
Bridge.Client.Self.Channel.Send(fmt.Sprintf("%v has left Discord channel\n", u.Username), false)
|
Bridge.Client.Self.Channel.Send(fmt.Sprintf("%v has left Discord channel\n", u.Username), false)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
Bridge.DiscordUserCount = count
|
Bridge.DiscordUserCount = count
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user