Skip to content

Commit

Permalink
feat: distinct guild stage voice channel from others
Browse files Browse the repository at this point in the history
  • Loading branch information
ayn2op committed Nov 9, 2024
1 parent 2cbf57c commit 6a4b983
Showing 1 changed file with 18 additions and 23 deletions.
41 changes: 18 additions & 23 deletions cmd/guilds_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,37 +80,32 @@ func (gt *GuildsTree) createGuildNode(n *tview.TreeNode, g discord.Guild) {
}

func (gt *GuildsTree) channelToString(c discord.Channel) string {
var s string
switch c.Type {
case discord.GuildText:
s = "#" + c.Name
case discord.DirectMessage:
r := c.DMRecipients[0]
s = r.Tag()
case discord.GuildVoice:
s = "v-" + c.Name
case discord.GroupDM:
s = c.Name
// If the name of the channel is empty, use the recipients' tags
if s == "" {
var recipients []string
for _, r := range c.DMRecipients {
recipients = append(recipients, r.DisplayOrUsername())
}
case discord.DirectMessage, discord.GroupDM:
if c.Name != "" {
return c.Name
}

s = strings.Join(recipients, ", ")
recipients := make([]string, len(c.DMRecipients))
for i, r := range c.DMRecipients {
recipients[i] = r.DisplayOrUsername()
}

return strings.Join(recipients, ", ")

case discord.GuildText:
return "#" + c.Name
case discord.GuildVoice, discord.GuildStageVoice:
return "v-" + c.Name
case discord.GuildAnnouncement:
s = "a-" + c.Name
return "a-" + c.Name
case discord.GuildStore:
s = "s-" + c.Name
return "s-" + c.Name
case discord.GuildForum:
s = "f-" + c.Name
return "f-" + c.Name
default:
s = c.Name
return c.Name
}

return s
}

func (gt *GuildsTree) createChannelNode(n *tview.TreeNode, c discord.Channel) *tview.TreeNode {
Expand Down

0 comments on commit 6a4b983

Please sign in to comment.