avakian

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2021 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package avakian implements Avakian's Discord client.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrClientOption = errors.New("bot: missing required option")
)

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Debug         bool
	DefaultPrefix string
	Admins        []string

	Twitter *twitter.Client
	DB      *sql.DB
	Logger  *zap.Logger
	Client  *harmony.Client
}

func NewBot

func NewBot(opts ...Option) (*Bot, error)

func (*Bot) AddRole

func (b *Bot) AddRole(ctx context.Context, gid, mid, rid, reason string) error

func (*Bot) CheckPermission

func (b *Bot) CheckPermission(ctx context.Context, sess bot.Session) (int, error)

func (*Bot) Connect

func (b *Bot) Connect(ctx context.Context) error

func (*Bot) CreateRole

func (b *Bot) CreateRole(ctx context.Context, gid, reason string, settings ...discord.RoleSetting) (*discord.Role, error)

func (*Bot) DeleteRole

func (b *Bot) DeleteRole(ctx context.Context, gid, rid, reason string) error

func (*Bot) Disconnect

func (b *Bot) Disconnect()

func (*Bot) FetchChannel

func (b *Bot) FetchChannel(ctx context.Context, id string) (*discord.Channel, error)

func (*Bot) FetchGuild

func (b *Bot) FetchGuild(ctx context.Context, id string) (*discord.Guild, error)

func (*Bot) FetchMember

func (b *Bot) FetchMember(ctx context.Context, mid, gid string) (*discord.GuildMember, error)

func (*Bot) FetchMemberPermissions

func (b *Bot) FetchMemberPermissions(ctx context.Context, gid, cid, mid string) (int, error)

func (*Bot) GuildPrefixes

func (b *Bot) GuildPrefixes(ctx context.Context, id string) ([]string, error)

func (*Bot) IsAdmin

func (b *Bot) IsAdmin(sf string) bool

func (*Bot) RemoveRole

func (b *Bot) RemoveRole(ctx context.Context, gid, mid, rid, reason string) error

func (*Bot) SendMessage

func (b *Bot) SendMessage(ctx context.Context, target string, message string) error

SendMessage sends a message to a Discord channel, and implements the commands.Dispatcher interface.

type Option

type Option func(*Bot)

func WithAdmins

func WithAdmins(admins []string) Option

func WithClient

func WithClient(c *harmony.Client) Option

func WithDB

func WithDB(d *sql.DB) Option

func WithDebug

func WithDebug(d bool) Option

func WithDefaultPrefix

func WithDefaultPrefix(p string) Option

func WithLogger

func WithLogger(l *zap.Logger) Option

func WithTwitter

func WithTwitter(t *twitter.Client) Option

Jump to

Keyboard shortcuts

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