discord

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

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) 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) Components

func (d *Discord) Components() []core.Component

func (*Discord) Configuration

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

func (*Discord) Description

func (d *Discord) Description() string

func (*Discord) HandleAction

func (d *Discord) HandleAction(ctx core.IntegrationActionContext) error

func (*Discord) HandleRequest

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

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 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"`
	Author    User    `json:"author"`
	Timestamp string  `json:"timestamp"`
	Embeds    []Embed `json:"embeds,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) Actions

func (c *SendTextMessage) Actions() []core.Action

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) HandleAction

func (c *SendTextMessage) HandleAction(ctx core.ActionContext) error

func (*SendTextMessage) HandleWebhook

func (c *SendTextMessage) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

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