The `NSFW` in channels doesn't get removed at times anymore.
MODIFY
internal/discordgoplus/channel.go
internal/discordgoplus/channel.go
@@ -8,6 +8,16 @@ import (
"github.com/Bios-Marcel/discordgo"
)
+// GetChannelNameForTree returns the string representation of a channel in
+// the channel tree on the left.
+func GetChannelNameForTree(channel *discordgo.Channel) string {
+ if channel.NSFW {
+ return channel.Name + " NSFW"
+ }
+
+ return channel.Name
+}
+
// GetPrivateChannelName generates a name for a private channel.
func GetPrivateChannelName(channel *discordgo.Channel) string {
var channelName string

MODIFY
internal/ui/window.go
internal/ui/window.go
@@ -226,18 +226,13 @@ func NewWindow(app *tview.Application, discord *discordgo.Session) (*Window, err
}
window.selectedChannelNode = node
- node.SetText(channelToConnectTo.Name)
+ node.SetText(discordgoplus.GetChannelNameForTree(channelToConnectTo))
node.SetColor(tcell.ColorTeal)
})
}
createNodeForChannel := func(channel *discordgo.Channel) *tview.TreeNode {
- nodeName := channel.Name
- if channel.NSFW {
- nodeName = nodeName + " NSFW"
- }
-
- return tview.NewTreeNode(nodeName)
+ return tview.NewTreeNode(discordgoplus.GetChannelNameForTree(channel))
}
channelCategories := make(map[string]*tview.TreeNode)
@@ -711,7 +706,7 @@ func NewWindow(app *tview.Application, discord *discordgo.Session) (*Window, err
if mentionsYou {
channel, stateError := window.session.State.Channel(message.ChannelID)
if stateError == nil {
- node.SetText("(@You) " + channel.Name)
+ node.SetText("(@You) " + discordgoplus.GetChannelNameForTree(channel))
}
}

The `NSFW` in channels doesn't get removed at times anymore.