Skip to content

Commit

Permalink
refactor: use ningen helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
ayn2op committed Sep 17, 2024
1 parent c8f82fa commit ce69326
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
6 changes: 1 addition & 5 deletions cmd/guilds_tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,16 +207,12 @@ func (gt *GuildsTree) onSelected(n *tview.TreeNode) {
gt.selectedChannelID = ref
app.SetFocus(mainFlex.messageInput)
case nil: // Direct messages
cs, err := discordState.Cabinet.PrivateChannels()
cs, err := discordState.PrivateChannels()
if err != nil {
log.Println(err)
return
}

sort.Slice(cs, func(i, j int) bool {
return cs[i].LastMessageID > cs[j].LastMessageID
})

for _, c := range cs {
gt.createChannelNode(n, c)
}
Expand Down
10 changes: 1 addition & 9 deletions cmd/messages_text.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,7 @@ func (mt *MessagesText) reset() {

func (mt *MessagesText) createMessage(m discord.Message) {
if cfg.HideBlockedUsers {
ready := discordState.Ready()
var isBlocked bool
for _, relationship := range ready.Relationships {
if relationship.Type == discord.BlockedRelationship && relationship.UserID == m.Author.ID {
isBlocked = true
break
}
}

isBlocked := discordState.UserIsBlocked(m.Author.ID)
if isBlocked {
fmt.Fprintln(mt, "[:red:b]Blocked message[:-:-]")
return
Expand Down

0 comments on commit ce69326

Please sign in to comment.