* Guild names in the guildtree are now being escaped
* Guilds that are incomplete are ignored and later on added by GuildCreate events
Fixes
MODIFY
ui/guildlist.go
ui/guildlist.go
@@ -35,7 +35,12 @@ func NewGuildList(guilds []*discordgo.Guild, window *Window) *GuildList {
})
for _, guild := range guilds {
- guildNode := tview.NewTreeNode(guild.Name)
+ //Guilds with an empty name are incomplete and we still have to wait
+ //for the respective GuildCreate event to be sent to us.
+ if guild.Name == "" {
+ continue
+ }
+ guildNode := tview.NewTreeNode(tview.Escape(guild.Name))
guildNode.SetReference(guild.ID)
root.AddChild(guildNode)
@@ -75,7 +80,7 @@ func (g *GuildList) RemoveGuild(guildID string) {
// AddGuild adds a new node that references the given guildID and shows the
// given name.
func (g *GuildList) AddGuild(guildID, name string) {
- node := tview.NewTreeNode(name)
+ node := tview.NewTreeNode(tview.Escape(name))
node.SetReference(guildID)
g.GetRoot().AddChild(node)
}
@@ -84,7 +89,7 @@ func (g *GuildList) AddGuild(guildID, name string) {
func (g *GuildList) UpdateName(guildID, newName string) {
for _, node := range g.GetRoot().GetChildren() {
if node.GetReference() == guildID {
- node.SetText(newName)
+ node.SetText(tview.Escape(newName))
break
}
}

* Guild names in the guildtree are now being escaped
* Guilds that are incomplete are ignored and later on added by GuildCreate events

Fixes #147