channel

package
v0.0.0-...-7245f98 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddRecipientOptions

type AddRecipientOptions struct {
	AccessToken string `json:"access_token"`
	Nick        string `json:"nick"`
}

AddRecipientOptions are used when adding a User to a Group DM.

type BulkDeleteMessagesOptions

type BulkDeleteMessagesOptions struct {
	Messages []string `json:"messages"`
}

BulkDeleteMessagesOptions are used to bulk delete Messages.

type CreateInviteOptions

type CreateInviteOptions struct {
	MaxAge              int                    `json:"max_age,omitempty"`
	MaxUses             int                    `json:"max_uses,omitempty"`
	Temporary           bool                   `json:"temporary,omitempty"`
	Unique              bool                   `json:"unique,omitempty"`
	TargetType          sigil.InviteTargetType `json:"target_type,omitempty"`
	TargetUserID        string                 `json:"target_user_id,omitempty"`
	TargetApplicationID string                 `json:"target_application_id,omitempty"`
}

CreateInviteOptions are used to create a new Invite to a Channel.

type CreateMessageOptions

type CreateMessageOptions struct {
	Content          string                  `json:"content,omitempty"`
	TTS              bool                    `json:"tts,omitempty"`
	Embeds           []*sigil.Embed          `json:"embeds,omitempty"`
	AllowedMentions  *sigil.AllowedMentions  `json:"allowed_mentions,omitempty"`
	MessageReference *sigil.MessageReference `json:"message_reference,omitempty"`
	Components       []*sigil.ActionRow      `json:"components,omitempty"`
	Files            []*sigil.File           `json:"-"`
	StickerIDs       []string                `json:"sticker_ids,omitempty"`
}

CreateMessageOptions are used to send a Message to the Channel.

type EditMessageOptions

type EditMessageOptions struct {
	Content         null.String            `json:"content,omitempty"`
	Embeds          []*sigil.Embed         `json:"embeds,omitempty"`
	Flags           sigil.MessageFlag      `json:"flags,omitempty"`
	AllowedMentions *sigil.AllowedMentions `json:"allowed_mentions,omitempty"`
	Components      []*sigil.ActionRow     `json:"components,omitempty"`
	Files           []*sigil.File          `json:"files,omitempty"`
}

EditMessagesOptions are used to edit a Message sent to the Channel.

type Fly

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

Fly is a resource for interacting with Channels.

func New

func New(client flies.RestClient, token, channelID string) *Fly

New creates a new Fly.

func (*Fly) AddRecipient

func (f *Fly) AddRecipient(ctx context.Context, userID string, opts *AddRecipientOptions) error

AddRecipient adds the given User to the Group DM using their access token.

func (*Fly) AddThreadMember

func (f *Fly) AddThreadMember(ctx context.Context, id string) error

AddThreadMember adds another Member to the Channel.

Channel must be a Thread.

func (*Fly) BulkDeleteMessages

func (f *Fly) BulkDeleteMessages(ctx context.Context, reason string, opts *BulkDeleteMessagesOptions) error

BulkDeleteMessages deletes multiple Messages in a single request. Can only be used in Guild channels.

Requires `MANAGE_MESSAGES`.

func (*Fly) CreateInvite

func (f *Fly) CreateInvite(ctx context.Context, reason string, opts *CreateInviteOptions) (*sigil.Invite, error)

CreateInvite creates a new Invite for the Channel using the given options. Only useable for Guild Channels.

Requires `CREATE_INSTANT_INVITE`.

func (*Fly) CreateMessage

func (f *Fly) CreateMessage(ctx context.Context, opts *CreateMessageOptions) (*sigil.Message, error)

CreateMessage sends a Message to the Channel from the given options.

func (*Fly) CreateReaction

func (f *Fly) CreateReaction(ctx context.Context, messageID, emoji string) error

CreateReaction creates a Reaction as the current User for the given Message by its ID.

Requires `READ_MESSAGE_HISTORY`, and if the first Reaction with this Emoji, requires `ADD_REACTIONS`.

To use a custom Emoji, pass `emoji` as `name:id`.

func (*Fly) CrosspostMessage

func (f *Fly) CrosspostMessage(ctx context.Context, messageID string) (*sigil.Message, error)

CrosspostMessage cross posts a Message in a News Channel to any Channel following it.

Requires `SEND_MESSAGES`, and `MANAGE_MESSAGES` if the current User did not send the target Message.

func (*Fly) DeleteAllReactions

func (f *Fly) DeleteAllReactions(ctx context.Context, messageID string) error

DeleteAllReactions clears every Reaction on the given Message.

Requires `MANAGE_MESSAGES`.

func (*Fly) DeleteAllReactionsForEmoji

func (f *Fly) DeleteAllReactionsForEmoji(ctx context.Context, messageID, emoji string) error

DeleteAllReactionsForEmoji clears every Reaction of the emoji on a given Message.

Requires `MANAGE_MESSAGES`.

func (*Fly) DeleteChannel

func (f *Fly) DeleteChannel(ctx context.Context, reason string) (*sigil.Channel, error)

DeleteChannel deletes the Channel, or closes a DM.

Requires `MANAGE_CHANNELS` if a Guild Channel, or `MANAGE_THREADS` if a Thread.

!!THIS ACTION IS IRREVERSIBLE, BE CAREFUL!!

func (*Fly) DeleteMessage

func (f *Fly) DeleteMessage(ctx context.Context, messageID, reason string) error

DeleteMessage removes the given Message from the Channel.

Requires `MANAGE_MESSAGES` if the Message was not sent by the current User.

func (*Fly) DeleteOwnReaction

func (f *Fly) DeleteOwnReaction(ctx context.Context, messageID, emoji string) error

DeleteOwnReaction deletes a Reaction the current User has made for the given Message.

To use a custom Emoji, pass `emoji` as `name:id`.

func (*Fly) DeletePermission

func (f *Fly) DeletePermission(ctx context.Context, id, reason string) error

DeletePermission removes a Permission Overwrite for the Channel.

Requires `MANAGE_ROLES`.

func (*Fly) DeleteUserReaction

func (f *Fly) DeleteUserReaction(ctx context.Context, messageID, userID string, emoji string) error

DeleteOwnReaction deletes a Reaction another User has made for the given Message.

Requires `MANAGE_MESSAGES`.

To use a custom Emoji, pass `emoji` as `name:id`.

func (*Fly) EditMessage

func (f *Fly) EditMessage(ctx context.Context, id string, opts *EditMessageOptions) (*sigil.Message, error)

func (*Fly) EditPermissions

func (f *Fly) EditPermissions(ctx context.Context, reason string, opts *sigil.Overwrite) error

EditPermissions edits the Permission Overwrites of the Channel using the given Overwrite object. Only useable in Guild Channels.

Requires `MANAGE_ROLES`

func (*Fly) FollowNewsChannel

func (f *Fly) FollowNewsChannel(ctx context.Context, webhookChannelID string) (*sigil.FollowedChannel, error)

FollowNewsChannel follows a News Channels to have Messages relayed to the Channel.

Requires `MANAGE_WEBHOOKS`.

func (*Fly) Get

func (f *Fly) Get(ctx context.Context) (*sigil.Channel, error)

Get fetches the Channel.

func (*Fly) GetMessage

func (f *Fly) GetMessage(ctx context.Context, id string) (*sigil.Message, error)

GetMessage fetches a single Message by its ID from the Channel.

Requires `READ_MESSAGE_HISTORY`.

func (*Fly) GetMessages

func (f *Fly) GetMessages(ctx context.Context, around, before, after string, limit int) ([]*sigil.Message, error)

GetMessages fetches a list of Messages from the Channel.

Requires `VIEW_CHANNEL` and `READ_MESSAGE_HISTORY`. `around`, `before`, and `after` are mutually exclusive.

func (*Fly) GetPinnedMessages

func (f *Fly) GetPinnedMessages(ctx context.Context) ([]*sigil.Message, error)

GetPinnedMessages fetches a list of all the pinned Messages in the Channel.

func (*Fly) GetReactions

func (f *Fly) GetReactions(ctx context.Context, messageID, emoji, after string, limit int) ([]*sigil.User, error)

GetReactions fetches a list of Users that have reacted to a Message with the given Emoji.

func (*Fly) GetThreadMember

func (f *Fly) GetThreadMember(ctx context.Context, id string) (*sigil.ThreadMember, error)

GetThreadMember returns a Thread Member. Application must have `GUILD_MEMBERS` intent.

Channel must be a Thread.

func (*Fly) JoinThread

func (f *Fly) JoinThread(ctx context.Context) error

JoinThread joins the Channel as the current user, if it is not archived.

Channel must be a Thread.

func (*Fly) LeaveThread

func (f *Fly) LeaveThread(ctx context.Context) error

LeaveThread removes the current User from the Channel.

Channel must be a Thread.

func (*Fly) ListJoinedPrivateArchivedThreads

func (f *Fly) ListJoinedPrivateArchivedThreads(ctx context.Context, before string, limit int) (*ListArchivedThreadsResponse, error)

ListJoinPrivateArchivedThreads fetches the list of private, archived Threads from the Channel, that the current User has joined. Threads are ordered by `archive_timestamp` in descending order.

Requires the `READ_MESSAGE_HISTORY` permission.

func (*Fly) ListPrivateArchivedThreads

func (f *Fly) ListPrivateArchivedThreads(ctx context.Context, before string, limit int) (*ListArchivedThreadsResponse, error)

ListPrivateArchivedThreads fetches the list of private, archived Threads from the Channel. Threads are ordered by `archive_timestamp` in descending order.

Requires the `READ_MESSAGE_HISTORY` and `MANAGE_THREADS` permission.

func (*Fly) ListPublicArchivedThreads

func (f *Fly) ListPublicArchivedThreads(ctx context.Context, before string, limit int) (*ListArchivedThreadsResponse, error)

ListPublicArchivedThreads fetches the list of public, archived Threads from the Channel. Threads are ordered by `archive_timestamp` in descending order.

Requires the `READ_MESSAGE_HISTORY` permission.

func (*Fly) ListThreadMembers

func (f *Fly) ListThreadMembers(ctx context.Context) ([]*sigil.ThreadMember, error)

ListThreadMembers retrieves a list of Thread Members from the Thread. Application must have `GUILD_MEMBERS` intent.

Channel must be a Thread.

func (*Fly) ModifyChannel

func (f *Fly) ModifyChannel(ctx context.Context, reason string, opts *ModifyChannelOptions) (*sigil.Channel, error)

ModifyChannel modifies the Channel with the given options.

Requires `MANAGE_CHANNELS`, and if modifiying overwrites, requires `MANAGE_ROLES`.

func (*Fly) ModifyGroupDM

func (f *Fly) ModifyGroupDM(ctx context.Context, reason string, opts *ModifyGroupDMOptions) (*sigil.Channel, error)

func (*Fly) ModifyThread

func (f *Fly) ModifyThread(ctx context.Context, reason string, opts *ModifyThreadOptions) (*sigil.Channel, error)

ModifyThread modifies the Channel with the given options.

Requires `MANAGE_THREADs`.

func (*Fly) PinMessage

func (f *Fly) PinMessage(ctx context.Context, messageID string) error

PinMessage pins the given Message in the Channel.

Requires `MANAGE_MESSAGES`.

func (*Fly) RemoveRecipient

func (f *Fly) RemoveRecipient(ctx context.Context, userID string) error

RemoveRecipient removes the given User from the Group DM.

func (*Fly) RemoveThreadMember

func (f *Fly) RemoveThreadMember(ctx context.Context, id string) error

RemoveThreadMember removes another Member from the Thread.

Channel must be a Thread.

func (*Fly) StartThreadWithMessage

func (f *Fly) StartThreadWithMessage(ctx context.Context, id, reason string, opts *StartThreadWithMessageOptions) (*sigil.Channel, error)

StartThreadWithMessage creates a new Thread from an existing message.

func (*Fly) StartThreadWithoutMessage

func (f *Fly) StartThreadWithoutMessage(ctx context.Context, reason string, opts *StartThreadWithoutMessageOptions) (*sigil.Channel, error)

StartThreadWithoutMessage creates a new Thread that is not connected a Message.

func (*Fly) TriggerTypingIndicator

func (f *Fly) TriggerTypingIndicator(ctx context.Context) error

TriggerTypingIndicator starts a typing indicator for the current User in the Channel.

func (*Fly) UnpinMessage

func (f *Fly) UnpinMessage(ctx context.Context, messageID, reason string) error

UnpinMessage unpins the given Message in the Channel.

Requires `MANAGE_MESSAGES`.

type ListArchivedThreadsResponse

type ListArchivedThreadsResponse struct {
	Threads []*sigil.Channel      `json:"threads"`
	Members []*sigil.ThreadMember `json:"members"`
	HasMore bool                  `json:"has_more"`
}

ListArchivedThreadsResponse is the expected response when querying archived Threads.

type ModifyChannelOptions

type ModifyChannelOptions struct {
	Name                       string             `json:"name,omitempty"`
	Type                       sigil.ChannelType  `json:"type,omitempty"`
	Position                   null.Int           `json:"position,omitempty"`
	Topic                      null.String        `json:"topic,omitempty"`
	NSFW                       null.Bool          `json:"nsfw,omitempty"`
	RateLimitPerUser           null.Int           `json:"rate_limit_per_user,omitempty"`
	Bitrate                    null.Int           `json:"bitrate,omitempty"`
	UserLimit                  null.Int           `json:"user_limit,omitempty"`
	PermissionOverwrites       []*sigil.Overwrite `json:"permission_overwrites,omitempty"`
	ParentID                   null.String        `json:"parent_id,omitempty"`
	RTCRegion                  sigil.VoiceRegion  `json:"rtc_region,omitempty"`
	VideoQualityMode           null.Int           `json:"video_quality_mode,omitempty"`
	DefaultAutoArchiveDuration null.Int           `json:"default_auto_archive_duration,omitempty"`
}

ModifyChannelOptions are used to modify a Channel.

type ModifyGroupDMOptions

type ModifyGroupDMOptions struct {
	Name string `json:"name,omitempty"`
	Icon string `json:"icon,omitempty"`
}

ModifyGroupDMOptions is used to modify a Group DM.

type ModifyThreadOptions

type ModifyThreadOptions struct {
	Name                string   `json:"name,omitempty"`
	Archived            bool     `json:"archived,omitempty"`
	AutoArchiveDuration int      `json:"auto_archive_duration,omitempty"`
	Locked              bool     `json:"locked,omitempty"`
	Invitable           bool     `json:"invitable,omitempty"`
	RateLimitPerUser    null.Int `json:"rate_limit_per_user,omitempty"`
}

ModifyThreadOptions are used to modify a Thread Channel.

type StartThreadWithMessageOptions

type StartThreadWithMessageOptions struct {
	Name                string
	AutoArchiveDuration int `json:"auto_archive_duration,omitempty"`
}

StartThreadWithMessageOptions are used to create a Thread with an existing Message.

type StartThreadWithoutMessageOptions

type StartThreadWithoutMessageOptions struct {
	Name                string            `json:"name"`
	AutoArchiveDuration int               `json:"auto_archive_duration,omitempty"`
	Type                sigil.ChannelType `json:"type,omitempty"`
	Invitable           bool              `json:"invitable,omitempty"`
}

StartThreadWithoutMessageOptions are used to create a new Thread.

Jump to

Keyboard shortcuts

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