Documentation ¶
Index ¶
- type ChatView
- type Editor
- func (editor *Editor) GetPrimitive() tview.Primitive
- func (editor *Editor) GetText() string
- func (editor *Editor) SetBackgroundColor(color tcell.Color)
- func (editor *Editor) SetInputCapture(captureFunc func(event *tcell.EventKey) *tcell.EventKey)
- func (editor *Editor) SetOnHeightChangeRequest(handler func(requestHeight int))
- func (editor *Editor) SetText(text string)
- type Window
- func (window *Window) AddMessages(messages []*discordgo.Message)
- func (window *Window) ExecuteCommand(command string)
- func (window *Window) LoadChannel(channel *discordgo.Channel) error
- func (window *Window) RefreshLayout()
- func (window *Window) RegisterCommand(name string, logic func(writer io.Writer, window *Window, parameters []string))
- func (window *Window) Run() error
- func (window *Window) SetMessages(messages []*discordgo.Message)
- func (window *Window) ShowErrorDialog(text string)
- func (window *Window) SwitchToFriendsPage()
- func (window *Window) SwitchToGuildsPage()
- func (window *Window) UpdateUsersForGuild(guild *discordgo.UserGuild)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatView ¶
type ChatView struct {
// contains filtered or unexported fields
}
ChatView is using a tview.TextView in order to be able to display messages in a simple way. It supports highlighting specific element types and it also supports multiline.
func NewChatView ¶
NewChatView constructs a new ready to use ChatView.
func (*ChatView) GetPrimitive ¶
GetPrimitive returns the component that can be added to a layout, since the ChatView itself is not a component.
func (*ChatView) SetMessages ¶
SetMessages defines all currently displayed messages. Parsing and manipulation of single message elements happens in this function.
type Editor ¶
type Editor struct {
// contains filtered or unexported fields
}
Editor is a simple component that wraps tview.TextView in order to gove the user minimal text edit functionality.
func (*Editor) GetPrimitive ¶
GetPrimitive returnbs the internal component that can be added to a layout
func (*Editor) SetBackgroundColor ¶
SetBackgroundColor sets the background color of the internal TextView
func (*Editor) SetInputCapture ¶
SetInputCapture sets the alternative input capture that will be used if the components default controls aren't being triggered.
func (*Editor) SetOnHeightChangeRequest ¶
SetOnHeightChangeRequest handles the cases where the component thinks it needs more space or would be fine with less.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
func NewWindow ¶
NewWindow constructs the whole application window and also registers all necessary handlers and functions. If this function returns an error, we can't start the application.
func (*Window) AddMessages ¶
AddMessages adds the passed array of messages to the chat.
func (*Window) ExecuteCommand ¶
ExecuteCommand tries to execute the given input as a command. The first word will be passed as the commands name and the rest will be parameters. If a command can't be found, that info will be printed onto the command output.
func (*Window) LoadChannel ¶
LoadChannel eagerly loads the channels messages.
func (*Window) RefreshLayout ¶
func (window *Window) RefreshLayout()
RefreshLayout removes and adds the main parts of the layout so that the ones that are disabled by settings do not show up.
func (*Window) RegisterCommand ¶
func (window *Window) RegisterCommand(name string, logic func(writer io.Writer, window *Window, parameters []string))
RegisterCommand register a command. That makes the command available for being called from the message input field, in case the user-defined prefix is in front of the input.
func (*Window) SetMessages ¶
SetMessages clears the current chat and adds the passed messages.s
func (*Window) ShowErrorDialog ¶
ShowErrorDialog shows a simple error dialog that has only an Okay button, a generic title and the given text.
func (*Window) SwitchToFriendsPage ¶
func (window *Window) SwitchToFriendsPage()
SwitchToFriendsPage switches the left side of the layout over to the view where you can see your private chats and groups. In addition to that it hides the user list.
func (*Window) SwitchToGuildsPage ¶
func (window *Window) SwitchToGuildsPage()
SwitchToGuildsPage the left side of the layout over to the view where you can see the servers and their channels. In additional to that, it also shows the user list in case the user didn't explicitly hide it.