1
0
mirror of https://github.com/stryan/mumble-discord-bridge.git synced 2024-11-22 21:35:44 -05:00

flag to disable discord bot status

This commit is contained in:
Tyler Stiene 2021-12-13 00:10:48 -05:00
parent 3d24e1dbc4
commit 08b4eb3771
2 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,7 @@ func main() {
discordSendBuffer := flag.Int("to-discord-buffer", lookupEnvOrInt("TO_DISCORD_BUFFER", 50), "TO_DISCORD_BUFFER, Jitter buffer from Mumble to Discord to absorb timing issues related to network, OS and hardware quality. (Increments of 10ms)") discordSendBuffer := flag.Int("to-discord-buffer", lookupEnvOrInt("TO_DISCORD_BUFFER", 50), "TO_DISCORD_BUFFER, Jitter buffer from Mumble to Discord to absorb timing issues related to network, OS and hardware quality. (Increments of 10ms)")
discordCommand := flag.String("discord-command", lookupEnvOrString("DISCORD_COMMAND", "mumble-discord"), "DISCORD_COMMAND, Discord command string, env alt DISCORD_COMMAND, optional, (defaults mumble-discord)") discordCommand := flag.String("discord-command", lookupEnvOrString("DISCORD_COMMAND", "mumble-discord"), "DISCORD_COMMAND, Discord command string, env alt DISCORD_COMMAND, optional, (defaults mumble-discord)")
discordDisableText := flag.Bool("discord-disable-text", lookupEnvOrBool("DISCORD_DISABLE_TEXT", false), "DISCORD_DISABLE_TEXT, disable sending direct messages to discord, (default false)") discordDisableText := flag.Bool("discord-disable-text", lookupEnvOrBool("DISCORD_DISABLE_TEXT", false), "DISCORD_DISABLE_TEXT, disable sending direct messages to discord, (default false)")
discordDisableBotStatus := flag.Bool("discord-disable-bot-status", lookupEnvOrBool("DISCORD_DISABLE_BOT_STATUS", false), "DISCORD_DISABLE_BOT_STATUS, disable updating bot status, (default false)")
mode := flag.String("mode", lookupEnvOrString("MODE", "constant"), "MODE, [constant, manual, auto] determine which mode the bridge starts in, (default constant)") mode := flag.String("mode", lookupEnvOrString("MODE", "constant"), "MODE, [constant, manual, auto] determine which mode the bridge starts in, (default constant)")
nice := flag.Bool("nice", lookupEnvOrBool("NICE", false), "NICE, whether the bridge should automatically try to 'nice' itself, (default false)") nice := flag.Bool("nice", lookupEnvOrBool("NICE", false), "NICE, whether the bridge should automatically try to 'nice' itself, (default false)")
debug := flag.Int("debug-level", lookupEnvOrInt("DEBUG", 1), "DEBUG_LEVEL, Discord debug level, optional, (default 1)") debug := flag.Int("debug-level", lookupEnvOrInt("DEBUG", 1), "DEBUG_LEVEL, Discord debug level, optional, (default 1)")
@ -135,6 +136,7 @@ func main() {
CID: *discordCID, CID: *discordCID,
DiscordStartStreamingCount: discordStartStreamingCount, DiscordStartStreamingCount: discordStartStreamingCount,
DiscordDisableText: *discordDisableText, DiscordDisableText: *discordDisableText,
DiscordDisableBotStatus: *discordDisableBotStatus,
Version: version, Version: version,
}, },
Connected: false, Connected: false,

View File

@ -42,6 +42,7 @@ type BridgeConfig struct {
CID string CID string
DiscordStartStreamingCount int DiscordStartStreamingCount int
DiscordDisableText bool DiscordDisableText bool
DiscordDisableBotStatus bool
Version string Version string
} }
@ -288,8 +289,10 @@ func (b *BridgeState) DiscordStatusUpdate() {
} }
b.BridgeMutex.Unlock() b.BridgeMutex.Unlock()
b.MumbleUsersMutex.Unlock() b.MumbleUsersMutex.Unlock()
if !b.BridgeConfig.DiscordDisableBotStatus {
b.DiscordSession.UpdateListeningStatus(status) b.DiscordSession.UpdateListeningStatus(status)
} }
}
discordHeartBeat := b.DiscordSession.LastHeartbeatAck.Sub(b.DiscordSession.LastHeartbeatSent).Milliseconds() discordHeartBeat := b.DiscordSession.LastHeartbeatAck.Sub(b.DiscordSession.LastHeartbeatSent).Milliseconds()
if discordHeartBeat > 0 { if discordHeartBeat > 0 {