refactor: move findByMessageID() to util.go
This commit is contained in:
parent
cbfd15ade8
commit
a91c1a35b4
2 changed files with 10 additions and 10 deletions
10
ui.go
10
ui.go
|
|
@ -225,16 +225,6 @@ func newMessagesTextView() *tview.TextView {
|
|||
return w
|
||||
}
|
||||
|
||||
func findByMessageID(ms []*discordgo.Message, mID string) (int, *discordgo.Message) {
|
||||
for i, m := range ms {
|
||||
if mID == m.ID {
|
||||
return i, m
|
||||
}
|
||||
}
|
||||
|
||||
return -1, nil
|
||||
}
|
||||
|
||||
func onMessagesTextViewInputCapture(e *tcell.EventKey) *tcell.EventKey {
|
||||
if selectedChannel == nil {
|
||||
return nil
|
||||
|
|
|
|||
10
util.go
10
util.go
|
|
@ -24,3 +24,13 @@ func genChannelRepr(c *discordgo.Channel) string {
|
|||
|
||||
return repr
|
||||
}
|
||||
|
||||
func findByMessageID(ms []*discordgo.Message, mID string) (int, *discordgo.Message) {
|
||||
for i, m := range ms {
|
||||
if mID == m.ID {
|
||||
return i, m
|
||||
}
|
||||
}
|
||||
|
||||
return -1, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue