discord

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GetLastMentionOutputChannelFound    = "found"
	GetLastMentionOutputChannelNotFound = "notFound"
)
View Source
const GetLastMentionPayloadType = "discord.getLastMention.result"

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID      string `json:"id"`
	Type    int    `json:"type"`
	GuildID string `json:"guild_id,omitempty"`
	Name    string `json:"name,omitempty"`
}

Channel represents a Discord channel object

type ChannelMetadata

type ChannelMetadata struct {
	ID   string `json:"id" mapstructure:"id"`
	Name string `json:"name" mapstructure:"name"`
}

type Client

type Client struct {
	BotToken string
}

func NewClient

func NewClient(ctx core.IntegrationContext) (*Client, error)

func (*Client) CreateMessage

func (c *Client) CreateMessage(channelID string, req CreateMessageRequest) (*Message, error)

CreateMessage sends a message to a channel

func (*Client) GetChannel

func (c *Client) GetChannel(channelID string) (*Channel, error)

GetChannel retrieves a channel by ID

func (*Client) GetChannelMessages added in v0.13.0

func (c *Client) GetChannelMessages(channelID string, limit int) ([]Message, error)

GetChannelMessages retrieves recent messages from a channel.

func (*Client) GetCurrentUser

func (c *Client) GetCurrentUser() (*User, error)

GetCurrentUser retrieves the current bot user

func (*Client) GetCurrentUserGuilds

func (c *Client) GetCurrentUserGuilds() ([]Guild, error)

GetCurrentUserGuilds retrieves the guilds the bot is a member of

func (*Client) GetGuildChannels

func (c *Client) GetGuildChannels(guildID string) ([]Channel, error)

GetGuildChannels retrieves the channels in a guild

type Configuration

type Configuration struct {
	BotToken string `json:"botToken" mapstructure:"botToken"`
}

type CreateMessageRequest

type CreateMessageRequest struct {
	Content string  `json:"content,omitempty"`
	Embeds  []Embed `json:"embeds,omitempty"`
}

CreateMessageRequest represents the request body for creating a message

type Discord

type Discord struct{}

func (*Discord) Actions

func (d *Discord) Actions() []core.Action

func (*Discord) Cleanup

func (d *Discord) Cleanup(ctx core.IntegrationCleanupContext) error

func (*Discord) Configuration

func (d *Discord) Configuration() []configuration.Field

func (*Discord) Description

func (d *Discord) Description() string

func (*Discord) HandleHook added in v0.18.0

func (d *Discord) HandleHook(ctx core.IntegrationHookContext) error

func (*Discord) HandleRequest

func (d *Discord) HandleRequest(ctx core.HTTPRequestContext)

func (*Discord) Hooks added in v0.18.0

func (d *Discord) Hooks() []core.Hook

func (*Discord) Icon

func (d *Discord) Icon() string

func (*Discord) Instructions

func (d *Discord) Instructions() string

func (*Discord) Label

func (d *Discord) Label() string

func (*Discord) ListResources

func (d *Discord) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Discord) Name

func (d *Discord) Name() string

func (*Discord) Sync

func (d *Discord) Sync(ctx core.SyncContext) error

func (*Discord) Triggers

func (d *Discord) Triggers() []core.Trigger

type Embed

type Embed struct {
	Title       string       `json:"title,omitempty"`
	Description string       `json:"description,omitempty"`
	URL         string       `json:"url,omitempty"`
	Color       int          `json:"color,omitempty"`
	Timestamp   string       `json:"timestamp,omitempty"`
	Footer      *EmbedFooter `json:"footer,omitempty"`
	Author      *EmbedAuthor `json:"author,omitempty"`
	Fields      []EmbedField `json:"fields,omitempty"`
	Thumbnail   *EmbedMedia  `json:"thumbnail,omitempty"`
	Image       *EmbedMedia  `json:"image,omitempty"`
}

Embed represents a Discord message embed

type EmbedAuthor

type EmbedAuthor struct {
	Name    string `json:"name"`
	URL     string `json:"url,omitempty"`
	IconURL string `json:"icon_url,omitempty"`
}

type EmbedField

type EmbedField struct {
	Name   string `json:"name"`
	Value  string `json:"value"`
	Inline bool   `json:"inline,omitempty"`
}

type EmbedFooter

type EmbedFooter struct {
	Text    string `json:"text"`
	IconURL string `json:"icon_url,omitempty"`
}

type EmbedMedia

type EmbedMedia struct {
	URL string `json:"url"`
}

type GetLastMention added in v0.13.0

type GetLastMention struct{}

func (*GetLastMention) Cancel added in v0.13.0

func (c *GetLastMention) Cancel(ctx core.ExecutionContext) error

func (*GetLastMention) Cleanup added in v0.13.0

func (c *GetLastMention) Cleanup(ctx core.SetupContext) error

func (*GetLastMention) Color added in v0.13.0

func (c *GetLastMention) Color() string

func (*GetLastMention) Configuration added in v0.13.0

func (c *GetLastMention) Configuration() []configuration.Field

func (*GetLastMention) Description added in v0.13.0

func (c *GetLastMention) Description() string

func (*GetLastMention) Documentation added in v0.13.0

func (c *GetLastMention) Documentation() string

func (*GetLastMention) ExampleOutput added in v0.13.0

func (c *GetLastMention) ExampleOutput() map[string]any

func (*GetLastMention) Execute added in v0.13.0

func (c *GetLastMention) Execute(ctx core.ExecutionContext) error

func (*GetLastMention) HandleHook added in v0.18.0

func (c *GetLastMention) HandleHook(ctx core.ActionHookContext) error

func (*GetLastMention) HandleWebhook added in v0.13.0

func (*GetLastMention) Hooks added in v0.18.0

func (c *GetLastMention) Hooks() []core.Hook

func (*GetLastMention) Icon added in v0.13.0

func (c *GetLastMention) Icon() string

func (*GetLastMention) Label added in v0.13.0

func (c *GetLastMention) Label() string

func (*GetLastMention) Name added in v0.13.0

func (c *GetLastMention) Name() string

func (*GetLastMention) OutputChannels added in v0.13.0

func (c *GetLastMention) OutputChannels(configuration any) []core.OutputChannel

func (*GetLastMention) ProcessQueueItem added in v0.13.0

func (c *GetLastMention) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*GetLastMention) Setup added in v0.13.0

func (c *GetLastMention) Setup(ctx core.SetupContext) error

type GetLastMentionConfiguration added in v0.13.0

type GetLastMentionConfiguration struct {
	Channel string `json:"channel" mapstructure:"channel"`
	Since   string `json:"since,omitempty" mapstructure:"since,omitempty"`
}

type GetLastMentionMetadata added in v0.13.0

type GetLastMentionMetadata struct {
	Channel *ChannelMetadata `json:"channel,omitempty" mapstructure:"channel,omitempty"`
}

type Guild

type Guild struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Guild represents a Discord guild (server) object

type Message

type Message struct {
	ID        string  `json:"id"`
	Type      int     `json:"type"`
	Content   string  `json:"content"`
	ChannelID string  `json:"channel_id"`
	GuildID   string  `json:"guild_id,omitempty"`
	Author    User    `json:"author"`
	Timestamp string  `json:"timestamp"`
	Embeds    []Embed `json:"embeds,omitempty"`
	Mentions  []User  `json:"mentions,omitempty"`
}

Message represents a Discord message object

type Metadata

type Metadata struct {
	BotID    string `json:"botId" mapstructure:"botId"`
	Username string `json:"username" mapstructure:"username"`
}

type SendTextMessage

type SendTextMessage struct{}

func (*SendTextMessage) Cancel

func (c *SendTextMessage) Cancel(ctx core.ExecutionContext) error

func (*SendTextMessage) Cleanup added in v0.7.0

func (c *SendTextMessage) Cleanup(ctx core.SetupContext) error

func (*SendTextMessage) Color

func (c *SendTextMessage) Color() string

func (*SendTextMessage) Configuration

func (c *SendTextMessage) Configuration() []configuration.Field

func (*SendTextMessage) Description

func (c *SendTextMessage) Description() string

func (*SendTextMessage) Documentation

func (c *SendTextMessage) Documentation() string

func (*SendTextMessage) ExampleOutput

func (c *SendTextMessage) ExampleOutput() map[string]any

func (*SendTextMessage) Execute

func (c *SendTextMessage) Execute(ctx core.ExecutionContext) error

func (*SendTextMessage) HandleHook added in v0.18.0

func (c *SendTextMessage) HandleHook(ctx core.ActionHookContext) error

func (*SendTextMessage) HandleWebhook

func (*SendTextMessage) Hooks added in v0.18.0

func (c *SendTextMessage) Hooks() []core.Hook

func (*SendTextMessage) Icon

func (c *SendTextMessage) Icon() string

func (*SendTextMessage) Label

func (c *SendTextMessage) Label() string

func (*SendTextMessage) Name

func (c *SendTextMessage) Name() string

func (*SendTextMessage) OutputChannels

func (c *SendTextMessage) OutputChannels(configuration any) []core.OutputChannel

func (*SendTextMessage) ProcessQueueItem

func (c *SendTextMessage) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*SendTextMessage) Setup

func (c *SendTextMessage) Setup(ctx core.SetupContext) error

type SendTextMessageConfiguration

type SendTextMessageConfiguration struct {
	Channel          string `json:"channel" mapstructure:"channel"`
	Content          string `json:"content" mapstructure:"content"`
	EmbedTitle       string `json:"embedTitle" mapstructure:"embedTitle"`
	EmbedDescription string `json:"embedDescription" mapstructure:"embedDescription"`
	EmbedColor       string `json:"embedColor" mapstructure:"embedColor"`
	EmbedURL         string `json:"embedUrl" mapstructure:"embedUrl"`
}

type SendTextMessageMetadata

type SendTextMessageMetadata struct {
	HasEmbed bool             `json:"hasEmbed" mapstructure:"hasEmbed"`
	Channel  *ChannelMetadata `json:"channel" mapstructure:"channel"`
}

type User

type User struct {
	ID            string `json:"id"`
	Username      string `json:"username"`
	Discriminator string `json:"discriminator"`
	Bot           bool   `json:"bot,omitempty"`
}

User represents a Discord user object

Jump to

Keyboard shortcuts

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