fix: Fix "Hang status" for new Discord version
This commit is contained in:
@@ -93,11 +93,16 @@ func removeUserFromChannels(s *discordgo.Session, vs *discordgo.VoiceStateUpdate
|
||||
}
|
||||
} else {
|
||||
createdChannels[vs.GuildID][channelID] = remove(channel, index)
|
||||
updateChannelName(s, vs.GuildID, channelID)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func updateNameOnJoin(s *discordgo.Session, vs *discordgo.VoiceStateUpdate) {
|
||||
updateChannelName(s, vs.GuildID, vs.ChannelID)
|
||||
}
|
||||
|
||||
func updateChannelName(s *discordgo.Session, guildID string, channelID string) {
|
||||
programs := make(map[string]int)
|
||||
|
||||
@@ -109,7 +114,7 @@ func updateChannelName(s *discordgo.Session, guildID string, channelID string) {
|
||||
name := "Stanza"
|
||||
|
||||
for program, count := range programs {
|
||||
if count > max {
|
||||
if program != "Stanza" && count > max {
|
||||
max = count
|
||||
name = program
|
||||
}
|
||||
@@ -142,5 +147,11 @@ func getActivity(st *discordgo.State, guildID string, userID string) string {
|
||||
return "Stanza"
|
||||
}
|
||||
|
||||
return presence.Activities[len(presence.Activities)-1].Name
|
||||
for _, activity := range presence.Activities {
|
||||
if activity.Name != "Hang Status" {
|
||||
return activity.Name
|
||||
}
|
||||
}
|
||||
|
||||
return "Stanza"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user