ui

package
v0.0.0-...-4e52b7f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 1, 2019 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

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

func NewChatView(session *discordgo.Session, ownUserID string) *ChatView

NewChatView constructs a new ready to use ChatView.

func (*ChatView) GetPrimitive

func (chatView *ChatView) GetPrimitive() tview.Primitive

GetPrimitive returns the component that can be added to a layout, since the ChatView itself is not a component.

func (*ChatView) SetMessages

func (chatView *ChatView) SetMessages(messages []*discordgo.Message)

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 NewEditor

func NewEditor() *Editor

NewEditor Instanciates a ready to use text editor.

func (*Editor) GetPrimitive

func (editor *Editor) GetPrimitive() tview.Primitive

GetPrimitive returnbs the internal component that can be added to a layout

func (*Editor) GetText

func (editor *Editor) GetText() string

GetText returns the text without color tags, region tags and so on.

func (*Editor) SetBackgroundColor

func (editor *Editor) SetBackgroundColor(color tcell.Color)

SetBackgroundColor sets the background color of the internal TextView

func (*Editor) SetInputCapture

func (editor *Editor) SetInputCapture(captureFunc func(event *tcell.EventKey) *tcell.EventKey)

SetInputCapture sets the alternative input capture that will be used if the components default controls aren't being triggered.

func (*Editor) SetOnHeightChangeRequest

func (editor *Editor) SetOnHeightChangeRequest(handler func(requestHeight int))

SetOnHeightChangeRequest handles the cases where the component thinks it needs more space or would be fine with less.

func (*Editor) SetText

func (editor *Editor) SetText(text string)

SetText sets the texts of the internal TextView, but also sets the selection and necessary groups for the navigation behaviour.

type Window

type Window struct {
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow(discord *discordgo.Session) (*Window, error)

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

func (window *Window) AddMessages(messages []*discordgo.Message)

AddMessages adds the passed array of messages to the chat.

func (*Window) ExecuteCommand

func (window *Window) ExecuteCommand(command string)

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

func (window *Window) LoadChannel(channel *discordgo.Channel) error

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) Run

func (window *Window) Run() error

Run Shows the window optionally returning an error.

func (*Window) SetMessages

func (window *Window) SetMessages(messages []*discordgo.Message)

SetMessages clears the current chat and adds the passed messages.s

func (*Window) ShowErrorDialog

func (window *Window) ShowErrorDialog(text string)

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.

func (*Window) UpdateUsersForGuild

func (window *Window) UpdateUsersForGuild(guild *discordgo.UserGuild)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL