Guild updates will cause to refresh the name in the GUI now.
MODIFY
ui/guildlist.go
ui/guildlist.go
@@ -79,3 +79,13 @@ func (g *GuildList) AddGuild(guildID, name string) {
node.SetReference(guildID)
g.GetRoot().AddChild(node)
}
+
+// UpdateName updates the name of the guild with the given ID.
+func (g *GuildList) UpdateName(guildID, newName string) {
+ for _, node := range g.GetRoot().GetChildren() {
+ if node.GetReference() == guildID {
+ node.SetText(newName)
+ break
+ }
+ }
+}

MODIFY
ui/window.go
ui/window.go
@@ -1347,6 +1347,11 @@ func (window *Window) registerGuildHandlers() {
guildRemoveChannel <- guildRemove
})
+ guildUpdateChannel := make(chan *discordgo.GuildUpdate, 3)
+ window.session.AddHandler(func(s *discordgo.Session, guildUpdate *discordgo.GuildUpdate) {
+ guildUpdateChannel <- guildUpdate
+ })
+
go func() {
for guildCreate := range guildCreateChannel {
window.app.QueueUpdateDraw(func() {
@@ -1355,6 +1360,14 @@ func (window *Window) registerGuildHandlers() {
}
}()
+ go func() {
+ for guildUpdate := range guildUpdateChannel {
+ window.app.QueueUpdateDraw(func() {
+ window.guildList.UpdateName(guildUpdate.ID, guildUpdate.Name)
+ })
+ }
+ }()
+
go func() {
for guildRemove := range guildRemoveChannel {
clearChannelTree := window.selectedGuildNode.GetReference() == guildRemove.ID

Guild updates will cause to refresh the name in the GUI now.