discordbot

package
v0.0.0-...-2597ab7 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package discordbot provides helper functionality around discordgo, useful for creating bots.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	*discord.Session
	// contains filtered or unexported fields
}

A Bot is a Discord Bot.

func Connect

func Connect(ctx context.Context, token string) (*Bot, *discord.Ready, error)

Connect connects to the Discord API as a bot, opens a session, and blocks until a Ready event is received or the Context expires.

func (*Bot) OnEmojiAdded

func (b *Bot) OnEmojiAdded(name string, cb func(*discord.Session, *ReactionAdded) error)

OnEmojiAdded calls cb when the specified emoji is added on any message. The emoji is identified by the value returned by discordgo.Eomji.APIName(); an empty string matches all emoji.

func (*Bot) OnEmojiRemoved

func (b *Bot) OnEmojiRemoved(name string, cb func(*discord.Session, *ReactionRemoved) error)

OnEmojiRemoved calls cb when the specified emoji is removed from any message. See OnEmojiAdded() for details on emoji names.

func (*Bot) SetErrHandler

func (b *Bot) SetErrHandler(h func(error))

SetErrHandler sets the function that is called when an error occurs while processing a callback.

type Reaction

type Reaction struct {
	*discord.MessageReaction
	Giver, Receiver *discord.User
}

A Reaction contains information about a reaction by a Giver on a message created by the Receiver of the reaction.

type ReactionAdded

type ReactionAdded struct {
	Reaction
}

ReactionAdded embeds a Reaction to signal that it was added.

type ReactionRemoved

type ReactionRemoved struct {
	Reaction
}

ReactionRemoved embeds a Reaction to signal that it was removed.

Jump to

Keyboard shortcuts

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