ui: move direct messages item to end
This commit is contained in:
parent
ac3651a882
commit
172f369838
3 changed files with 13 additions and 18 deletions
18
README.md
18
README.md
|
|
@ -30,15 +30,15 @@ Discordo is a lightweight, secure, and feature-rich Discord terminal client. Hea
|
|||
|
||||
### Roadmap
|
||||
|
||||
- [] Mentions (autocompletion & suggestions)
|
||||
- [] Attachments
|
||||
- [] Typing indicator
|
||||
- [] Scripting interface
|
||||
- [] Threads
|
||||
- [] Members sidebar
|
||||
- [] Search/filter messages
|
||||
- [] User profile
|
||||
- [] Settings widgets
|
||||
- [ ] Mentions (autocompletion & suggestions)
|
||||
- [ ] Attachments
|
||||
- [ ] Typing indicator
|
||||
- [ ] Scripting interface
|
||||
- [ ] Threads
|
||||
- [ ] Members sidebar
|
||||
- [ ] Search/filter messages
|
||||
- [ ] User profile
|
||||
- [ ] Settings widgets
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
|
|||
|
|
@ -110,8 +110,6 @@ func (app *App) DrawMainFlex() {
|
|||
}
|
||||
|
||||
func (app *App) onSessionReady(_ *discordgo.Session, r *discordgo.Ready) {
|
||||
app.GuildsList.AddItem("Direct Messages", "", 0, nil)
|
||||
|
||||
sort.Slice(r.Guilds, func(a, b int) bool {
|
||||
found := false
|
||||
for _, guildID := range r.Settings.GuildPositions {
|
||||
|
|
@ -129,6 +127,8 @@ func (app *App) onSessionReady(_ *discordgo.Session, r *discordgo.Ready) {
|
|||
for _, g := range r.Guilds {
|
||||
app.GuildsList.AddItem(g.Name, "", 0, nil)
|
||||
}
|
||||
|
||||
app.GuildsList.AddItem("Direct Messages", "", 0, nil)
|
||||
}
|
||||
|
||||
func (app *App) onSessionGuildCreate(_ *discordgo.Session, g *discordgo.GuildCreate) {
|
||||
|
|
|
|||
|
|
@ -37,12 +37,7 @@ func (gl *GuildsList) onSelected(idx int, mainText string, secondaryText string,
|
|||
Clear()
|
||||
gl.app.MessageInputField.SetText("")
|
||||
|
||||
// If the user is a bot account, the direct messages item does not exist in the guilds list.
|
||||
if gl.app.Session.State.User.Bot && idx == 0 {
|
||||
idx = 1
|
||||
}
|
||||
|
||||
if idx == 0 { // Direct Messages
|
||||
if mainText == "Direct Messages" {
|
||||
cs := gl.app.Session.State.PrivateChannels
|
||||
sort.Slice(cs, func(i, j int) bool {
|
||||
return cs[i].LastMessageID > cs[j].LastMessageID
|
||||
|
|
@ -54,7 +49,7 @@ func (gl *GuildsList) onSelected(idx int, mainText string, secondaryText string,
|
|||
rootTreeNode.AddChild(channelTreeNode)
|
||||
}
|
||||
} else { // Guild
|
||||
cs := gl.app.Session.State.Guilds[idx-1].Channels
|
||||
cs := gl.app.Session.State.Guilds[idx].Channels
|
||||
sort.Slice(cs, func(i, j int) bool {
|
||||
return cs[i].Position < cs[j].Position
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue