messages

package
v0.0.24 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: GPL-3.0 Imports: 51 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	*gtk.Box
	// contains filtered or unexported fields
}

Content is the message content widget.

func NewContent

func NewContent(ctx context.Context, v *View) *Content

NewContent creates a new Content widget.

func (*Content) ChannelID

func (c *Content) ChannelID() discord.ChannelID

ChannelID returns the channel ID.

func (*Content) MessageID

func (c *Content) MessageID() discord.MessageID

MessageID returns the message ID.

func (*Content) Redact

func (c *Content) Redact()

Redact clears the content widget.

func (*Content) SetCustomChild

func (c *Content) SetCustomChild(child ...gtk.Widgetter)

func (*Content) SetExtraMenu

func (c *Content) SetExtraMenu(menu gio.MenuModeller)

SetExtraMenu implements ExtraMenuSetter.

func (*Content) SetReactions

func (c *Content) SetReactions(reactions []discord.Reaction)

SetReactions sets the reactions inside the message.

func (*Content) Update

func (c *Content) Update(m *discord.Message, customs ...gtk.Widgetter)

Update replaces Content with the message.

type ExtraMenuSetter

type ExtraMenuSetter interface {
	SetExtraMenu(gio.MenuModeller)
}

ExtraMenuSetter is an interface for types that implement SetExtraMenu.

type Message

type Message interface {
	gtk.Widgetter
	Update(*gateway.MessageCreateEvent)
	Redact()
	Content() *Content
	Message() *discord.Message
}

TODO: Implement BlockedMessage widget Message describes a Message widget.

func NewCollapsedMessage

func NewCollapsedMessage(ctx context.Context, v *View) Message

NewCollapsedMessage creates a new collapsed cozy message.

func NewCozyMessage

func NewCozyMessage(ctx context.Context, v *View) Message

NewCozyMessage creates a new cozy message.

type MessageWithUser

type MessageWithUser interface {
	Message
	UpdateMember(*discord.Member)
}

MessageWithUser extends Message for types that also show user information.

type TypingIndicator

type TypingIndicator struct {
	*gtk.Revealer
	// contains filtered or unexported fields
}

TypingIndicator is a struct that represents a typing indicator box.

func NewTypingIndicator

func NewTypingIndicator(ctx context.Context, chID discord.ChannelID) *TypingIndicator

NewTypingIndicator creates a new TypingIndicator.

func (*TypingIndicator) AddTyper

func (t *TypingIndicator) AddTyper(userID discord.UserID, when discord.UnixTimestamp)

AddTyper adds a typer to the typing indicator.

func (*TypingIndicator) AddTyperMember

func (t *TypingIndicator) AddTyperMember(userID discord.UserID, when discord.UnixTimestamp, member *discord.Member)

AddTyperMember adds a typer to the typing indicator with a member object.

func (*TypingIndicator) RemoveTyper

func (t *TypingIndicator) RemoveTyper(userID discord.UserID)

RemoveTyper removes a typer from the typing indicator.

type View

type View struct {
	*adaptive.LoadablePage

	ToastOverlay    *adw.ToastOverlay
	LoadMore        *gtk.Button
	Scroll          *autoscroll.Window
	List            *gtk.ListBox
	Composer        *composer.View
	TypingIndicator *TypingIndicator
	// contains filtered or unexported fields
}

View is a message view widget.

func NewView

func NewView(ctx context.Context, chID discord.ChannelID) *View

NewView creates a new View widget associated with the given channel ID. All methods call on it will act on that channel.

func (*View) AddReaction

func (v *View) AddReaction(id discord.MessageID, emoji discord.APIEmoji)

AddReaction adds an reaction to the message with the given ID.

func (*View) AddToast

func (v *View) AddToast(toast *adw.Toast)

AddToast adds a toast to the message view.

func (*View) ChannelID

func (v *View) ChannelID() discord.ChannelID

ChannelID returns the channel ID of the message view.

func (*View) ChannelName

func (v *View) ChannelName() string

ChannelName returns the name of the channel that the message view is displaying for.

func (*View) Delete

func (v *View) Delete(id discord.MessageID)

Delete deletes the message with the given ID. It may prompt the user to confirm the deletion.

func (*View) Edit

func (v *View) Edit(id discord.MessageID)

Edit starts editing the message with the given ID.

func (*View) EditLastMessage

func (v *View) EditLastMessage() bool

EditLastMessage implements composer.Controller.

func (*View) GuildID

func (v *View) GuildID() discord.GuildID

GuildID returns the guild ID of the channel that the message view is displaying for.

func (*View) HeaderButtons

func (v *View) HeaderButtons() []gtk.Widgetter

HeaderButtons returns the header buttons widget for the message view. This widget is kept on the header bar for as long as the message view is active.

func (*View) IsActive

func (v *View) IsActive() bool

IsActive returns true if View is active and visible. This implies that the window is focused.

func (*View) MarkRead

func (v *View) MarkRead()

MarkRead marks the view's latest messages as read.

func (*View) ReplyTo

func (v *View) ReplyTo(id discord.MessageID)

ReplyTo starts replying to the message with the given ID.

func (*View) ScrollToMessage

func (v *View) ScrollToMessage(id discord.MessageID)

ScrollToMessage scrolls to the message with the given ID.

func (*View) SendMessage

func (v *View) SendMessage(msg composer.SendingMessage)

SendMessage implements composer.Controller.

func (*View) StopEditing

func (v *View) StopEditing()

StopEditing implements composer.Controller.

func (*View) StopReplying

func (v *View) StopReplying()

StopReplying implements composer.Controller.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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