소스 검색

Do not check for permissions for DirectMessage and GroupDM

ayn2op 3 년 전
부모
커밋
521a9fa52a
1개의 변경된 파일9개의 추가작업 그리고 6개의 파일을 삭제
  1. 9 6
      guilds_tree.go

+ 9 - 6
guilds_tree.go

@@ -108,13 +108,16 @@ func (gt *GuildsTree) channelToString(c discord.Channel) string {
 }
 
 func (gt *GuildsTree) createChannelNode(n *tview.TreeNode, c discord.Channel) {
-	ps, err := discordState.Permissions(c.ID, discordState.Ready().User.ID)
-	if err != nil {
-		return
-	}
+	if c.Type != discord.DirectMessage && c.Type != discord.GroupDM {
+		ps, err := discordState.Permissions(c.ID, discordState.Ready().User.ID)
+		if err != nil {
+			log.Println(err)
+			return
+		}
 
-	if !ps.Has(discord.PermissionViewChannel) {
-		return
+		if !ps.Has(discord.PermissionViewChannel) {
+			return
+		}
 	}
 
 	cn := tview.NewTreeNode(gt.channelToString(c))