message

package
v0.0.5-0...-0379fef Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2021 License: GPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Input

type Input struct {
	*handy.Column
	Messages *Messages

	Main  *gtk.Box
	Style *gtk.StyleContext

	Completer *completer.State

	InputBox *gtk.Box
	Input    *gtk.TextView
	InputBuf *gtk.TextBuffer
	Upload   *gtk.Button
	Emoji    *gtk.Button
	Send     *gtk.Button

	Bottom *gtk.Box
	Typing *typing.State

	// | Typing...      | Editing. _Cancel_ |
	EditRevealer *gtk.Revealer
	EditLabel    *gtk.Label
	EditCancel   *gtk.Button

	Editing *discord.Message
}

func NewInput

func NewInput(m *Messages) (i *Input)

type Message

type Message struct {
	*gtk.ListBoxRow

	Nonce    string
	ID       discord.MessageID
	AuthorID discord.UserID
	Author   string
	Webhook  bool

	Timestamp time.Time
	Edited    time.Time

	Condensed      bool
	CondenseOffset time.Duration

	OnUserClick  func(m *Message)
	OnRightClick func(m *Message, btn *gdk.EventButton)
	// contains filtered or unexported fields
}

func (*Message) SetCondensedUnsafe

func (m *Message) SetCondensedUnsafe(condensed bool)

func (*Message) UpdateAvatar

func (m *Message) UpdateAvatar(url string)

func (*Message) UpdateContentUnsafe

func (m *Message) UpdateContentUnsafe(s *ningen.State, update *discord.Message)

func (*Message) UpdateMember

func (m *Message) UpdateMember(s *ningen.State, gID discord.GuildID, n discord.Member)

type Messages

type Messages struct {
	Opts
	gtkutils.ExtendedWidget

	Main   *gtk.Box
	Column *handy.Column

	Scroll   *gtk.ScrolledWindow
	Viewport *gtk.Viewport

	Messages *gtk.ListBox

	// Additional components
	Input *Input
	// contains filtered or unexported fields
}

func NewMessages

func NewMessages(s *ningen.State, opts Opts) (*Messages, error)

func (*Messages) Cleanup

func (m *Messages) Cleanup()

func (*Messages) Focus

func (m *Messages) Focus()

Focus on the input box

func (*Messages) GetChannelID

func (m *Messages) GetChannelID() discord.ChannelID

func (*Messages) GetGuildID

func (m *Messages) GetGuildID() discord.GuildID

func (*Messages) GetRecentAuthorsUnsafe

func (m *Messages) GetRecentAuthorsUnsafe(limit int) []discord.UserID

func (*Messages) LastFromMeUnsafe

func (m *Messages) LastFromMeUnsafe() *Message

unsafe

func (*Messages) Load

func (m *Messages) Load(channel discord.ChannelID, done func(error))

Load is thread-safe. Done will be called in the main thread.

func (*Messages) ScrollToBottom

func (m *Messages) ScrollToBottom()

func (*Messages) SetWidth

func (m *Messages) SetWidth(width int)

func (*Messages) UpdateUnsafe

func (m *Messages) UpdateUnsafe(update *discord.Message) bool

func (*Messages) UpsertUnsafe

func (m *Messages) UpsertUnsafe(message *discord.Message)

type Opts

type Opts struct {
	// Whether or not the sent messages should be "obfuscated" with zero-width
	// space characters, which avoids telemetry somewhat.
	InputZeroWidth bool // true

	// Whether or not gtkcord should send typing events to the Discord server
	// and announce it.
	InputOnTyping bool // true

	MessageWidth int
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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