discord

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PermissionAdministrator       = 8
	PermissionViewAuditLog        = 128
	PermissionViewServerInsights  = 524288
	PermissionManageServer        = 32
	PermissionManageRoles         = 268435456
	PermissionManageChannels      = 16
	PermissionKickMembers         = 2
	PermissionBanMembers          = 4
	PermissionCreateInstantInvite = 1
	PermissionChangeNickname      = 67108864
	PermissionManageNicknames     = 134217728
	PermissionManageEmojis        = 1073741824
	PermissionManageWebhooks      = 536870912
	PermissionViewChannel         = 1024
)

General permissions

View Source
const (
	PermissionSendMessages       = 2048
	PermissionSendTTSMessages    = 4096
	PermissionManageMessages     = 8192
	PermissionEmbedLinks         = 16384
	PermissionAttachFiles        = 32768
	PermissionReadMessageHistory = 65536
	PermissionMentionEveryone    = 131072
	PermissionUseExternalEmojis  = 262144
	PermissionAddReactions       = 64
	PermissionUseSlashCommands   = 2147483648
)

Text channels

Variables

This section is empty.

Functions

This section is empty.

Types

type Dispatcher

type Dispatcher interface {

	// Client returns the internal Discord client
	Client() client.Client

	// AddCommand registers a command for the dispatcher
	AddCommand(command command.Command) Dispatcher

	// AddReaction registers a reaction for the dispatcher
	AddReaction(reaction reaction.Reaction) Dispatcher

	// OnMessage add a callback on messages
	OnMessage(callback OnMessageFn) Dispatcher

	// Listen for reactions and commands
	Listen()

	// Close dispatcher
	Close()
}

func NewDispatcher

func NewDispatcher(token string) (Dispatcher, error)

type Message

type Message struct {

	// UserID is the user that performed the command
	UserID string

	// UserPermission holds the user permission
	UserPermissions int64

	// GuildID is the guild where the command was performed
	GuildID string

	// CategoryID is the category where the command was performed
	CategoryID string

	// ChannelID is the channel where the command was performed
	ChannelID string

	// MessageID holds the message where the command was performed
	MessageID string

	// Content holds the message content
	Content string
}

type OnMessageFn

type OnMessageFn func(message *Message)

type Session

type Session interface {

	// GuildChannelTextCreate
	GuildChannelTextCreate(guildID, categoryID string, name string) (channelID string, err error)

	// ChannelDelete
	ChannelDelete(channelID string) (err error)

	// ChannelPermissionDelete
	ChannelPermissionDelete(channelID, targetID string) (err error)

	// ChannelMessageSend
	ChannelMessageSend(channelID string, content string) (messageID string, err error)

	// ChannelMessageDelete
	ChannelMessageDelete(channelID, messageID string) (err error)

	// UserChannelPermissionSet
	UserChannelPermissionSet(channelID, targetID string, allow, deny int64) (err error)

	// UserChannelPermissions
	UserChannelPermissions(userID, channelID string) (permissions int64, err error)

	// MessageReactionAdd
	MessageReactionAdd(channelID, messageID, emojiID string) (err error)

	// MessageReactionRemove
	MessageReactionRemove(channelID, messageID, emojiID, userID string) (err error)
}

Session is an interface

Directories

Path Synopsis
Package clientmock is a generated GoMock package.
Package clientmock is a generated GoMock package.
Package commandmock is a generated GoMock package.
Package commandmock is a generated GoMock package.
Package reactionmock is a generated GoMock package.
Package reactionmock is a generated GoMock package.

Jump to

Keyboard shortcuts

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