Przeglądaj źródła

Only display channels of type GUILD_TEXT & GUILD_NEWS (exclude GUILD_VOICE) (#13)

rigormorrtiss 4 lat temu
rodzic
commit
c5985eb91d
1 zmienionych plików z 3 dodań i 3 usunięć
  1. 3 3
      discordo.go

+ 3 - 3
discordo.go

@@ -182,7 +182,7 @@ func onGuildsDropDownSelected(text string, _ int) {
 		case discordgo.ChannelTypeGuildCategory:
 			channelNode.SetColor(tcell.GetColor(config.Theme.TreeNodeForeground))
 			channelsTreeNode.AddChild(channelNode)
-		default:
+		case discordgo.ChannelTypeGuildText, discordgo.ChannelTypeGuildNews:
 			if channel.ParentID == "" {
 				channelNode.SetText("[::d]#" + channel.Name + "[-:-:-]")
 				channelsTreeNode.AddChild(channelNode)
@@ -205,7 +205,7 @@ func onChannelsTreeViewSelected(node *tview.TreeNode) {
 		if len(node.GetChildren()) == 0 {
 			for i := range currentGuild.Channels {
 				channel := currentGuild.Channels[i]
-				if channel.ParentID == currentChannel.ID {
+				if (channel.Type == discordgo.ChannelTypeGuildText || channel.Type == discordgo.ChannelTypeGuildNews) && channel.ParentID == currentChannel.ID {
 					channelNode := tview.NewTreeNode("[::d]#" + channel.Name + "[-:-:-]").
 						SetReference(channel)
 					node.AddChild(channelNode)
@@ -214,7 +214,7 @@ func onChannelsTreeViewSelected(node *tview.TreeNode) {
 		} else {
 			node.SetExpanded(!node.IsExpanded())
 		}
-	case discordgo.ChannelTypeGuildText:
+	case discordgo.ChannelTypeGuildText, discordgo.ChannelTypeGuildNews:
 		messagesTextView.SetTitle(currentChannel.Name)
 		app.SetFocus(messageInputField)