discordo/ui/inputfields.go
rigormorrtiss 1a2be50e14 feat: implement Threads (#25)
* main: refactor MESSAGe_CREATE event to separate function

* main: add thread channel as child to guild text channel

* main: write thread channel messages to messages TextView on select

* *: refactor to use for range loops

* main: write discord.Message.ReferencedMessage if message type is ThreadStarterMessage

* fix(util): write Message.Content if it is not an empty string

* refactor(util): remove WriteMessages

* refactor(main): defer-close websocket connection

* refactor(main): update api.UserAgent to latest

* refactor: use named return values

* fix: increase guilds TreeView fixedSize

* docs(README): update preview
2021-08-15 10:01:02 +04:00

21 lines
620 B
Go

package ui
import (
"github.com/gdamore/tcell/v2"
"github.com/rigormorrtiss/discordo/util"
"github.com/rivo/tview"
)
func NewMessageInputField(onMessageInputFieldInputCapture func(*tcell.EventKey) *tcell.EventKey, theme *util.Theme) (i *tview.InputField) {
i = tview.NewInputField()
i.
SetPlaceholder("Message...").
SetPlaceholderTextColor(tcell.ColorWhite).
SetFieldBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
SetBackgroundColor(tcell.GetColor(theme.InputFieldBackground)).
SetBorder(true).
SetBorderPadding(0, 0, 1, 1).
SetInputCapture(onMessageInputFieldInputCapture)
return
}