make NICE option toggleable

This commit is contained in:
stryan 2021-01-12 10:40:12 -05:00
parent 5616814c83
commit 0973c3bf25

15
main.go
View File

@ -29,8 +29,9 @@ func main() {
discordToken := flag.String("discord-token", lookupEnvOrString("DISCORD_TOKEN", ""), "DISCORD_TOKEN, discord bot token") discordToken := flag.String("discord-token", lookupEnvOrString("DISCORD_TOKEN", ""), "DISCORD_TOKEN, discord bot token")
discordGID := flag.String("discord-gid", lookupEnvOrString("DISCORD_GID", ""), "DISCORD_GID, discord gid") discordGID := flag.String("discord-gid", lookupEnvOrString("DISCORD_GID", ""), "DISCORD_GID, discord gid")
discordCID := flag.String("discord-cid", lookupEnvOrString("DISCORD_CID", ""), "DISCORD_CID, discord cid") discordCID := flag.String("discord-cid", lookupEnvOrString("DISCORD_CID", ""), "DISCORD_CID, discord cid")
discordCommand := flag.String("discord-command", lookupEnvOrString("DISCORD_COMMAND", "mumble-discord"), "Discord command string, env alt DISCORD_COMMAND, optional, defaults to mumble-discord") discordCommand := flag.String("discord-command", lookupEnvOrString("DISCORD_COMMAND", "mumble-discord"), "DISCORD_COMMAND,Discord command string, env alt DISCORD_COMMAND, optional, defaults to mumble-discord")
mode := flag.String("mode", lookupEnvOrString("MODE", "manual"), "determine which mode the bridge starts in") mode := flag.String("mode", lookupEnvOrString("MODE", "manual"), "MODE,determine which mode the bridge starts in")
nice := flag.Bool("nice", lookupEnvOrBool("NICE", false), "NICE,whether the bridge should automatically try to 'nice' itself")
flag.Parse() flag.Parse()
log.Printf("app.config %v\n", getConfig(flag.CommandLine)) log.Printf("app.config %v\n", getConfig(flag.CommandLine))
@ -53,10 +54,12 @@ func main() {
if *mode == "" { if *mode == "" {
log.Fatalln("missing mode set") log.Fatalln("missing mode set")
} }
//err := syscall.Setpriority(syscall.PRIO_PROCESS, os.Getpid(), -5) if *nice {
//if err != nil { err := syscall.Setpriority(syscall.PRIO_PROCESS, os.Getpid(), -5)
// log.Println("Unable to set priority. ", err) if err != nil {
//} log.Println("Unable to set priority. ", err)
}
}
//Connect to discord //Connect to discord
discord, err := discordgo.New("Bot " + *discordToken) discord, err := discordgo.New("Bot " + *discordToken)