Documentation ¶
Index ¶
- Variables
- func PrompSecretSingleLineInput(app *tview.Application, title, message string) string
- func PromptSingleLineInput(app *tview.Application, activePrimitiveChanged func(primitive tview.Primitive), ...) string
- type ActiveView
- type Autocomplete
- type AutocompleteValue
- type ChannelTree
- func (channelTree *ChannelTree) AddOrUpdateChannel(channel *discordgo.Channel)
- func (channelTree *ChannelTree) Clear()
- func (channelTree *ChannelTree) LoadGuild(guildID string) error
- func (channelTree *ChannelTree) MarkAsLoaded(channelID string)
- func (channelTree *ChannelTree) MarkAsMentioned(channelID string)
- func (channelTree *ChannelTree) MarkAsRead(channelID string)
- func (channelTree *ChannelTree) MarkAsUnread(channelID string)
- func (channelTree *ChannelTree) RemoveChannel(channel *discordgo.Channel)
- func (channelTree *ChannelTree) SetOnChannelSelect(handler func(channelID string))
- type ChatView
- func (chatView *ChatView) AddMessage(message *discordgo.Message)
- func (chatView *ChatView) ClearSelection()
- func (chatView *ChatView) ClearViewAndCache()
- func (chatView *ChatView) DeleteMessage(deletedMessage *discordgo.Message)
- func (chatView *ChatView) DeleteMessages(deletedMessages []string)
- func (chatView *ChatView) GetPrimitive() tview.Primitive
- func (chatView *ChatView) Reprint()
- func (chatView *ChatView) SetMessages(messages []*discordgo.Message)
- func (chatView *ChatView) SetOnMessageAction(...)
- func (chatView *ChatView) SetTitle(text string)
- func (chatView *ChatView) SignalSelectionDeleted()
- func (chatView *ChatView) UpdateMessage(updatedMessage *discordgo.Message)
- type CommandView
- func (cmdView *CommandView) GetCommandInputWidget() *tview.TextView
- func (cmdView *CommandView) GetCommandOutputWidget() *tview.TextView
- func (cmdView *CommandView) SetInputCaptureForInput(handler func(event *tcell.EventKey) *tcell.EventKey)
- func (cmdView *CommandView) SetInputCaptureForOutput(handler func(event *tcell.EventKey) *tcell.EventKey)
- func (cmdView *CommandView) SetVisible(visible bool)
- func (cmdView *CommandView) Write(p []byte) (n int, err error)
- type Editor
- func (editor *Editor) Autocomplete(value string)
- func (editor *Editor) Backspace()
- func (editor *Editor) DeleteRight()
- func (editor *Editor) DeleteWordLeft()
- func (editor *Editor) FindAtSymbolIndexInCurrentWord() int
- func (editor *Editor) GetPrimitive() tview.Primitive
- func (editor *Editor) GetRequestedHeight() int
- func (editor *Editor) GetText() string
- func (editor *Editor) GetTextLeftOfSelection() string
- func (editor *Editor) InsertCharacter(character rune)
- func (editor *Editor) MoveCursorEndOfLine()
- func (editor *Editor) MoveCursorEndOfText()
- func (editor *Editor) MoveCursorLeft()
- func (editor *Editor) MoveCursorRight()
- func (editor *Editor) MoveCursorStartOfLine()
- func (editor *Editor) MoveCursorStartOfText()
- func (editor *Editor) MoveCursorWordLeft()
- func (editor *Editor) MoveCursorWordRight()
- func (editor *Editor) Paste(event *tcell.EventKey)
- func (editor *Editor) RegisterAutocomplete(firstRune rune, allowSpaces bool, ...)
- func (editor *Editor) RerenderTitle()
- func (editor *Editor) SelectAll()
- func (editor *Editor) SelectToEndOfLine()
- func (editor *Editor) SelectToEndOfText()
- func (editor *Editor) SelectToStartOfLine()
- func (editor *Editor) SelectToStartOfText()
- func (editor *Editor) SelectWordLeft()
- func (editor *Editor) SelectWordRight()
- func (editor *Editor) SelectionToLeft()
- func (editor *Editor) SelectionToRight()
- func (editor *Editor) SetAutocompleteValuesUpdateHandler(handlerFunc func(values []*AutocompleteValue))
- func (editor *Editor) SetBackgroundColor(color tcell.Color)
- func (editor *Editor) SetBorderBlinking(blinking bool)
- func (editor *Editor) SetBorderColor(color tcell.Color)
- func (editor *Editor) SetBorderFocusColor(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)
- func (editor *Editor) SetTitle(text string)
- func (editor *Editor) ShowReply(replyUser string)
- func (editor *Editor) ShowSlowMode(slowmodeString string)
- func (editor *Editor) TriggerHeightRequestIfNecessary()
- type GuildList
- func (g *GuildList) AddGuild(guildID, name string)
- func (g *GuildList) MarkAsLoaded(guildID string)
- func (g *GuildList) RemoveGuild(guildID string)
- func (g *GuildList) SetOnGuildSelect(handler func(guildID string))
- func (g *GuildList) UpdateName(guildID, newName string)
- func (g *GuildList) UpdateNodeStateByGuild(guild *discordgo.Guild, loaded bool)
- func (g *GuildList) UpdateUnreadGuildCount()
- type Login
- type LoginType
- type PrivateChatList
- func (privateList *PrivateChatList) AddOrUpdateChannel(channel *discordgo.Channel)
- func (privateList *PrivateChatList) AddOrUpdateFriend(user *discordgo.User)
- func (privateList *PrivateChatList) FetchStatus(id string) (status string)
- func (privateList *PrivateChatList) GetComponent() *tview.TreeView
- func (privateList *PrivateChatList) Load()
- func (privateList *PrivateChatList) MarkAsLoaded(channelID string)
- func (privateList *PrivateChatList) MarkAsRead(channelID string)
- func (privateList *PrivateChatList) MarkAsUnread(channelID string)
- func (privateList *PrivateChatList) RemoveChannel(channel *discordgo.Channel)
- func (privateList *PrivateChatList) RemoveFriend(userID string)
- func (privateList *PrivateChatList) Reorder()
- func (privateList *PrivateChatList) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKey)
- func (privateList *PrivateChatList) SetOnChannelSelect(handler func(channelID string))
- func (privateList *PrivateChatList) SetOnFriendSelect(handler func(userID string))
- type UserTree
- func (userTree *UserTree) AddOrUpdateMember(member *discordgo.Member)
- func (userTree *UserTree) AddOrUpdateMembers(members []*discordgo.Member)
- func (userTree *UserTree) AddOrUpdateUser(user *discordgo.User)
- func (userTree *UserTree) AddOrUpdateUsers(users []*discordgo.User)
- func (userTree *UserTree) Clear()
- func (userTree *UserTree) FetchStatus(id string) (status string)
- func (userTree *UserTree) LoadGroup(channelID string) error
- func (userTree *UserTree) LoadGuild(guildID string) error
- func (userTree *UserTree) RemoveMember(member *discordgo.Member)
- func (userTree *UserTree) RemoveMembers(members []*discordgo.Member)
- func (userTree *UserTree) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKey)
- type Window
- func (window *Window) ApplyFixedLayoutSettings()
- func (window *Window) DisplaySlowmode(currentTime, totalTime int)
- func (window *Window) ExecuteCommand(input string)
- func (window *Window) FindCommand(name string) commands.Command
- func (window *Window) ForceRedraw()
- func (window *Window) GetRegisteredCommands() []commands.Command
- func (window *Window) GetSelectedChannel() *discordgo.Channel
- func (window *Window) GetSelectedGuild() *discordgo.Guild
- func (window *Window) IsCursorInsideCodeBlock() bool
- func (window *Window) LoadChannel(channel *discordgo.Channel) error
- func (window *Window) OpenDirectMessage(userID string) error
- func (window *Window) PromptSecretInput(title, message string) string
- func (window *Window) QueueUpdateDrawSynchronized(runnable func())
- func (window *Window) RegisterCommand(command commands.Command)
- func (window *Window) Run() error
- func (window *Window) SetCommandModeEnabled(enabled bool)
- func (window *Window) ShowCustomErrorDialog(title, text string)
- func (window *Window) ShowDialog(color tcell.Color, text string, buttonHandler func(button string), ...)
- func (window *Window) ShowErrorDialog(text string)
- func (window *Window) ShowTFASetup() error
- func (window *Window) Shutdown()
- func (window *Window) SwitchToFriendsPage()
- func (window *Window) SwitchToGuildsPage()
- func (window *Window) SwitchToPreviousChannel() error
- func (window *Window) SwitchToPrivateChannel(channel *discordgo.Channel)
- func (window *Window) TrySendMessage(targetChannel *discordgo.Channel, message string, replyMsg *discordgo.Message, ...)
- func (window *Window) UnloadChannel()
- func (window *Window) UpdateChatHeader(channel *discordgo.Channel)
Constants ¶
This section is empty.
Variables ¶
var WelcomeText = `` /* 770-byte string literal not displayed */
Functions ¶
func PrompSecretSingleLineInput ¶
func PrompSecretSingleLineInput(app *tview.Application, title, message string) string
PrompSecretSingleLineInput shows a fullscreen input dialog that masks the user input. The returned value will either be empty or what the user has entered.
func PromptSingleLineInput ¶
func PromptSingleLineInput(app *tview.Application, activePrimitiveChanged func(primitive tview.Primitive), title, message string) string
PromptSingleLineInput shows a fullscreen input dialog. The returned value will either be empty or what the user has entered.
Types ¶
type Autocomplete ¶
type Autocomplete struct {
// contains filtered or unexported fields
}
type AutocompleteValue ¶
type ChannelTree ¶
ChannelTree is the component that displays the channel hierarchy of the currently loaded guild and allows interactions with those channels.
func NewChannelTree ¶
func NewChannelTree(state *discordgo.State) *ChannelTree
NewChannelTree creates a new ready-to-be-used ChannelTree
func (*ChannelTree) AddOrUpdateChannel ¶
func (channelTree *ChannelTree) AddOrUpdateChannel(channel *discordgo.Channel)
AddOrUpdateChannel either adds a new node for the given channel or updates its current node.
func (*ChannelTree) LoadGuild ¶
func (channelTree *ChannelTree) LoadGuild(guildID string) error
LoadGuild accesses the state in order to load all locally present channels for the passed guild.
func (*ChannelTree) MarkAsLoaded ¶
func (channelTree *ChannelTree) MarkAsLoaded(channelID string)
MarkAsLoaded marks a channel as loaded and therefore marks all other channels as either unread, read or mentioned.
func (*ChannelTree) MarkAsMentioned ¶
func (channelTree *ChannelTree) MarkAsMentioned(channelID string)
MarkAsMentioned marks a channel as mentioned.
func (*ChannelTree) MarkAsRead ¶
func (channelTree *ChannelTree) MarkAsRead(channelID string)
MarkAsRead marks a channel as read.
func (*ChannelTree) MarkAsUnread ¶
func (channelTree *ChannelTree) MarkAsUnread(channelID string)
MarkAsUnread marks a channel as unread.
func (*ChannelTree) RemoveChannel ¶
func (channelTree *ChannelTree) RemoveChannel(channel *discordgo.Channel)
RemoveChannel removes a channels node from the tree.
func (*ChannelTree) SetOnChannelSelect ¶
func (channelTree *ChannelTree) SetOnChannelSelect(handler func(channelID string))
SetOnChannelSelect sets the handler that reacts to channel selection events.
type ChatView ¶
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) AddMessage ¶
AddMessage add an additional message to the ChatView.
func (*ChatView) ClearSelection ¶
func (chatView *ChatView) ClearSelection()
ClearSelection clears the current selection of messages.
func (*ChatView) ClearViewAndCache ¶
func (chatView *ChatView) ClearViewAndCache()
ClearViewAndCache clears the TextView buffer and removes all data for all messages.
func (*ChatView) DeleteMessage ¶
DeleteMessage drops the message from the cache and triggers a reprint
func (*ChatView) DeleteMessages ¶
DeleteMessages drops the messages from the cache and triggers a reprint
func (*ChatView) GetPrimitive ¶
GetPrimitive returns the component that can be added to a layout, since the ChatView itself is not a component.
func (*ChatView) Reprint ¶
func (chatView *ChatView) Reprint()
Reprint clears the internal TextView and prints all currently cached messages into the internal TextView again. This will not actually cause a redraw in the user interface. This would still only be done by ForceDraw ,QueueUpdateDraw or user events. Calling this method is necessary if previously added content has changed or has been removed, since can only append to the TextViews buffers, but not cut parts out.
func (*ChatView) SetMessages ¶
SetMessages defines all currently displayed messages. Parsing and manipulation of single message elements happens in this function.
func (*ChatView) SetOnMessageAction ¶
func (chatView *ChatView) SetOnMessageAction(onMessageAction func(message *discordgo.Message, event *tcell.EventKey) *tcell.EventKey)
SetOnMessageAction sets the handler that will get called if the user tries to interact with a selected message.
func (*ChatView) SignalSelectionDeleted ¶
func (chatView *ChatView) SignalSelectionDeleted()
SignalSelectionDeleted notifies the ChatView that its currently selected message doesn't exist anymore, moving the selection up by a row if possible.
func (*ChatView) UpdateMessage ¶
UpdateMessage reformats the passed message, updates the cache and triggers a reprint.
type CommandView ¶
type CommandView struct {
// contains filtered or unexported fields
}
CommandView contains a simple textview for output and an input field for input. All commands are added to the history when confirmed via enter.
func NewCommandView ¶
func NewCommandView(app *tview.Application, onExecuteCommand func(command string)) *CommandView
NewCommandView creates a new struct containing the components necessary for a command view. It also contains the state for those components.
func (*CommandView) GetCommandInputWidget ¶
func (cmdView *CommandView) GetCommandInputWidget() *tview.TextView
GetCommandInputWidget returns the component that can be added to the layout for the users command input.
func (*CommandView) GetCommandOutputWidget ¶
func (cmdView *CommandView) GetCommandOutputWidget() *tview.TextView
GetCommandOutputWidget is the component that can be added to the layout for the users command output.
func (*CommandView) SetInputCaptureForInput ¶
func (cmdView *CommandView) SetInputCaptureForInput(handler func(event *tcell.EventKey) *tcell.EventKey)
SetInputCaptureForInput defines the input capture for the input component of the command view while prioritizing the predefined handler before passing the event to the externally specified handler.
func (*CommandView) SetInputCaptureForOutput ¶
func (cmdView *CommandView) SetInputCaptureForOutput(handler func(event *tcell.EventKey) *tcell.EventKey)
SetInputCaptureForOutput defines the input capture for the output component of the command view while prioritizing the predefined handler before passing the event to the externally specified handler.
func (*CommandView) SetVisible ¶
func (cmdView *CommandView) SetVisible(visible bool)
SetVisible sets the given visible state to both the input component and the output component
type Editor ¶
type Editor struct { // App is the tview Application this editor is used in. The reference is // required to query the current bracketed paste state. App *tview.Application // contains filtered or unexported fields }
Editor is a simple component that wraps tview.TextView in order to give the user minimal text edit functionality.
func NewEditor ¶
func NewEditor(app *tview.Application) *Editor
func NewEditorWithWindow ¶
NewEditor instantiates a ready to use text editor.
func (*Editor) Autocomplete ¶
func (*Editor) DeleteRight ¶
func (editor *Editor) DeleteRight()
func (*Editor) DeleteWordLeft ¶
func (editor *Editor) DeleteWordLeft()
func (*Editor) FindAtSymbolIndexInCurrentWord ¶
func (*Editor) GetPrimitive ¶
GetPrimitive returns the internal component that can be added to a layout
func (*Editor) GetRequestedHeight ¶
GetRequestedHeight returns the currently requested size.
func (*Editor) GetTextLeftOfSelection ¶
func (*Editor) InsertCharacter ¶
func (*Editor) MoveCursorEndOfLine ¶
func (editor *Editor) MoveCursorEndOfLine()
func (*Editor) MoveCursorEndOfText ¶
func (editor *Editor) MoveCursorEndOfText()
func (*Editor) MoveCursorLeft ¶
func (editor *Editor) MoveCursorLeft()
MoveCursorLeft moves the cursor left by one cell.
func (*Editor) MoveCursorRight ¶
func (editor *Editor) MoveCursorRight()
MoveCursorRight moves the cursor right by one cell.
func (*Editor) MoveCursorStartOfLine ¶
func (editor *Editor) MoveCursorStartOfLine()
func (*Editor) MoveCursorStartOfText ¶
func (editor *Editor) MoveCursorStartOfText()
func (*Editor) MoveCursorWordLeft ¶
func (editor *Editor) MoveCursorWordLeft()
func (*Editor) MoveCursorWordRight ¶
func (editor *Editor) MoveCursorWordRight()
func (*Editor) RegisterAutocomplete ¶
func (editor *Editor) RegisterAutocomplete(firstRune rune, allowSpaces bool, valueSupplier func(string) []*AutocompleteValue)
func (*Editor) RerenderTitle ¶
func (editor *Editor) RerenderTitle()
RerenderTitle re-renders the title text, making sure the reply user & mention, and slowmode are correct
func (*Editor) SelectAll ¶
func (editor *Editor) SelectAll()
SelectAll selects all text (cells) currently filled. If no text is available, nothing will change.
func (*Editor) SelectToEndOfLine ¶
func (editor *Editor) SelectToEndOfLine()
SelectToEndOfLine will select all text to the right til the next newline is found. Lines doesn't mean "editor line" in this context, as the editor doesn't currently support vertical navigation.
func (*Editor) SelectToEndOfText ¶
func (editor *Editor) SelectToEndOfText()
SelectToEndOfText will select all text to the end of the editor. Meaning the bottom-right most cell.
func (*Editor) SelectToStartOfLine ¶
func (editor *Editor) SelectToStartOfLine()
SelectToStartOfLine will select all text to the left til the next newline is found. Lines doesn't mean "editor line" in this context, as the editor doesn't currently support vertical navigation.
func (*Editor) SelectToStartOfText ¶
func (editor *Editor) SelectToStartOfText()
SelectToStartOfText will select all text to the start of the editor. Meaning the top-left most cell.
func (*Editor) SelectWordLeft ¶
func (editor *Editor) SelectWordLeft()
SelectWordLeft extends the selection one word to the left. A word may span multiple words. A word however can be one cell and mustn't be a word in terms of human language definition.
func (*Editor) SelectWordRight ¶
func (editor *Editor) SelectWordRight()
SelectWordRight extends the selection one word to the right. A word may span multiple words. A word however can be one cell and mustn't be a word in terms of human language definition.
func (*Editor) SelectionToLeft ¶
func (editor *Editor) SelectionToLeft()
SelectionToLeft extends the selection one cell to the left.
func (*Editor) SelectionToRight ¶
func (editor *Editor) SelectionToRight()
SelectionToRight extends the selection one cell to the right.
func (*Editor) SetAutocompleteValuesUpdateHandler ¶
func (editor *Editor) SetAutocompleteValuesUpdateHandler(handlerFunc func(values []*AutocompleteValue))
func (*Editor) SetBackgroundColor ¶
SetBackgroundColor sets the background color of the internal TextView
func (*Editor) SetBorderBlinking ¶
SetBorderBlinking sets the blinking attribute of the border in tview.
func (*Editor) SetBorderColor ¶
SetBorderColor delegates to the underlying components SetBorderColor method.
func (*Editor) SetBorderFocusColor ¶
SetBorderFocusColor delegates to the underlying components SetBorderFocusColor method.
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.
func (*Editor) SetText ¶
SetText sets the texts of the internal TextView, but also sets the selection and necessary groups for the navigation behaviour.
func (*Editor) ShowSlowMode ¶
ShowSlowMode displays slowmode status on top of the editor
func (*Editor) TriggerHeightRequestIfNecessary ¶
func (editor *Editor) TriggerHeightRequestIfNecessary()
TriggerHeightRequestIfNecessary informs the parent that more or less height is requierd for rendering than currently in use, unless the height is already optimal.
type GuildList ¶
GuildList is the UI component to hold all user guilds and allow loading one of them.
func NewGuildList ¶
NewGuildList creates and initializes a ready to use GuildList.
func (*GuildList) AddGuild ¶
AddGuild adds a new node that references the given guildID and shows the given name.
func (*GuildList) MarkAsLoaded ¶
MarkAsLoaded selects the guild and marks it as loaded.
func (*GuildList) RemoveGuild ¶
RemoveGuild removes the node that refers to the given guildID.
func (*GuildList) SetOnGuildSelect ¶
SetOnGuildSelect sets the handler for when a guild is selected.
func (*GuildList) UpdateName ¶
UpdateName updates the name of the guild with the given ID.
func (*GuildList) UpdateNodeStateByGuild ¶
UpdateNodeStateByGuild updates the state of a guilds node accordingly to its readstate, unless the guild represented by that node is loaded.
func (*GuildList) UpdateUnreadGuildCount ¶
func (g *GuildList) UpdateUnreadGuildCount()
UpdateUnreadGuildCount finds the number of guilds containing unread channels and updates the title accordingly.
type Login ¶
type PrivateChatList ¶
type PrivateChatList struct {
// contains filtered or unexported fields
}
PrivateChatList holds the nodes and handlers for the private view. That is the one responsible for managing private chats and friends.
func NewPrivateChatList ¶
func NewPrivateChatList(state *discordgo.State) *PrivateChatList
NewPrivateChatList creates a new ready to use private chat list.
func (*PrivateChatList) AddOrUpdateChannel ¶
func (privateList *PrivateChatList) AddOrUpdateChannel(channel *discordgo.Channel)
AddOrUpdateChannel either adds a channel or updates the node if it is already present
func (*PrivateChatList) AddOrUpdateFriend ¶
func (privateList *PrivateChatList) AddOrUpdateFriend(user *discordgo.User)
AddOrUpdateFriend either adds a friend or updates the node if it is already present.
func (*PrivateChatList) FetchStatus ¶
func (privateList *PrivateChatList) FetchStatus(id string) (status string)
func (*PrivateChatList) GetComponent ¶
func (privateList *PrivateChatList) GetComponent() *tview.TreeView
GetComponent returns the TreeView component that is used. This component is the top-level container of this struct.
func (*PrivateChatList) Load ¶
func (privateList *PrivateChatList) Load()
Load loads all present data (chats, groups and friends).
func (*PrivateChatList) MarkAsLoaded ¶
func (privateList *PrivateChatList) MarkAsLoaded(channelID string)
MarkAsLoaded marks a channel as loaded, coloring it blue. If a different channel had loaded before, it's set to read.
func (*PrivateChatList) MarkAsRead ¶
func (privateList *PrivateChatList) MarkAsRead(channelID string)
MarkAsRead marks a channel as read.
func (*PrivateChatList) MarkAsUnread ¶
func (privateList *PrivateChatList) MarkAsUnread(channelID string)
MarkAsUnread marks the channel as unread, coloring it red.
func (*PrivateChatList) RemoveChannel ¶
func (privateList *PrivateChatList) RemoveChannel(channel *discordgo.Channel)
RemoveChannel removes a channel node if present.
func (*PrivateChatList) RemoveFriend ¶
func (privateList *PrivateChatList) RemoveFriend(userID string)
RemoveFriend removes a friend node if present. This will not trigger any action on the channel list.
func (*PrivateChatList) Reorder ¶
func (privateList *PrivateChatList) Reorder()
Reorder resorts the list of private chats according to their last message times.
func (*PrivateChatList) SetInputCapture ¶
func (privateList *PrivateChatList) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKey)
SetInputCapture delegates to tviews SetInputCapture
func (*PrivateChatList) SetOnChannelSelect ¶
func (privateList *PrivateChatList) SetOnChannelSelect(handler func(channelID string))
SetOnChannelSelect sets the handler that decides what happens when a channel node gets selected.
func (*PrivateChatList) SetOnFriendSelect ¶
func (privateList *PrivateChatList) SetOnFriendSelect(handler func(userID string))
SetOnFriendSelect sets the handler that decides what happens when a friend node gets selected.
type UserTree ¶
UserTree represents the visual list of users in a guild.
func NewUserTree ¶
NewUserTree creates a new pre-configured UserTree that is empty.
func (*UserTree) AddOrUpdateMember ¶
AddOrUpdateMember adds the passed member to the tree, unless it is already part of the tree, in that case the nodes name is updated.
func (*UserTree) AddOrUpdateMembers ¶
AddOrUpdateMembers adds the all passed members to the tree, unless a node is already part of the tree, in that case the nodes name is updated.
func (*UserTree) AddOrUpdateUser ¶
AddOrUpdateUser adds a user to the tree, unless the user already exists, in that case the users node gets updated.
func (*UserTree) AddOrUpdateUsers ¶
AddOrUpdateUsers adds users to the tree, unless they already exists, in that case the users nodes gets updated.
func (*UserTree) Clear ¶
func (userTree *UserTree) Clear()
Clear removes all nodes and data out of the view.
func (*UserTree) FetchStatus ¶
func (*UserTree) LoadGuild ¶
LoadGuild will load all available roles of the guild and then load all available members. Afterwards the first available node will be selected.
func (*UserTree) RemoveMember ¶
RemoveMember finds and removes a node from the tree.
func (*UserTree) RemoveMembers ¶
RemoveMembers finds and removes all passed members from the tree.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is basically the whole application, as it contains all the components and the necessary global state.
func NewWindow ¶
func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *discordgo.Ready) (*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) ApplyFixedLayoutSettings ¶
func (window *Window) ApplyFixedLayoutSettings()
ApplyFixedLayoutSettings applies the current settings for the FixedLayout to the window. This means resizing the components.
func (*Window) DisplaySlowmode ¶
DisplaySlowmode takes the slowmode of a channel and the current remaining countdown wait time and displays it on the chatbox
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) FindCommand ¶
FindCommand searches through the registered command, whether any of them equals the passed name.
func (*Window) ForceRedraw ¶
func (window *Window) ForceRedraw()
ForceRedraw triggers ForceDraw on the underlying tview application, causing it to redraw all currently shown components.
func (*Window) GetRegisteredCommands ¶
GetRegisteredCommands returns the map of all registered commands.
func (*Window) GetSelectedChannel ¶
GetSelectedChannel returns a reference to the currently selected Channel.
func (*Window) GetSelectedGuild ¶
GetSelectedGuild returns a reference to the currently selected Guild.
func (*Window) IsCursorInsideCodeBlock ¶
IsCursorInsideCodeBlock checks if the cursor comes after three backticks that don't have another 3 backticks following after them.
func (*Window) LoadChannel ¶
LoadChannel eagerly loads the channels messages.
func (*Window) OpenDirectMessage ¶
OpenDirectMessage creates a new chat with the given user or loads an already existing one. On success, the channel is loaded.
func (*Window) PromptSecretInput ¶
PromptSecretInput shows a fullscreen input dialog that masks the user input. The returned value will either be empty or what the user has entered.
func (*Window) QueueUpdateDrawSynchronized ¶
func (window *Window) QueueUpdateDrawSynchronized(runnable func())
QueueUpdateDrawSynchronized is meant to be used by goroutines that aren't the main goroutine in order to wait for the UI-Thread to execute the given If this method is ever called from the main thread, the application will deadlock.
func (*Window) RegisterCommand ¶
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) SetCommandModeEnabled ¶
SetCommandModeEnabled hides or shows the command ui elements and toggles the commandMode flag.
func (*Window) ShowCustomErrorDialog ¶
ShowCustomErrorDialog shows a simple error dialog with a custom title and text. The button says "Okay" and only closes the dialog.
func (*Window) ShowDialog ¶
func (window *Window) ShowDialog(color tcell.Color, text string, buttonHandler func(button string), buttons ...string)
ShowDialog shows a dialog at the bottom of the window. It doesn't surrender its focus and requires action before allowing the user to proceed. The buttons are handled depending on their text.
func (*Window) ShowErrorDialog ¶
ShowErrorDialog shows a simple error dialog that has only an Okay button, a generic title and the given text.
func (*Window) ShowTFASetup ¶
ShowTFASetup generates a new TFA-Secret and shows a QR-Code. The QR-Code can be scanned and the resulting TFA-Token can be entered into cordless and used to enable TFA on this account.
func (*Window) Shutdown ¶
func (window *Window) Shutdown()
Shutdown disconnects from the discord API and stops the tview application.
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) SwitchToPreviousChannel ¶
SwitchToPreviousChannel loads the previously loaded channel and focuses it in it's respective UI primitive.
func (*Window) SwitchToPrivateChannel ¶
SwitchToPrivateChannel switches to the friends page, loads the given channel and then focuses the input primitive.
func (*Window) TrySendMessage ¶
func (*Window) UnloadChannel ¶
func (window *Window) UnloadChannel()
UnloadChannel resets the windows to the state at which no channel has been loaded yet.
func (*Window) UpdateChatHeader ¶
UpdateChatHeader updates the bordertitle of the chatviews container.o The title consist of the channel name and its topic for guild channels. For private channels it's either the recipient in a dm, or all recipients in a group dm channel. If the channel has a nickname, that is chosen.