bot

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

type Bot struct {
	Session *discordgo.Session
	Sugar   *wlog.Wlog
	Pool    *cbdb.Db
	Bolt    *cbdb.BoltDb

	MemberCache *MemberCache
	UserCache   *UserCache
	RoleCache   *RoleCache

	Handlers *ttlcache.Cache

	Config    structs.BotConfig
	Version   string
	GitVer    string
	StartTime time.Time

	SnowflakeGen *snowflake.Generator
}

Bot ...

func NewBot

func NewBot(s *discordgo.Session, l *wlog.Wlog, p *cbdb.Db, b *cbdb.BoltDb, c structs.BotConfig, h *ttlcache.Cache, version, gitVer string, startTime time.Time) *Bot

NewBot returns a Bot struct

func (*Bot) GetGuildMembers

func (b *Bot) GetGuildMembers(s *discordgo.Session, _ *discordgo.Ready)

GetGuildMembers ...

func (*Bot) GuildMemberChunk

func (b *Bot) GuildMemberChunk(s *discordgo.Session, chunk *discordgo.GuildMembersChunk)

GuildMemberChunk ...

func (*Bot) GuildMemberUpdate

func (b *Bot) GuildMemberUpdate(s *discordgo.Session, m *discordgo.GuildMemberUpdate)

GuildMemberUpdate ...

func (*Bot) GuildRoleUpdate

func (b *Bot) GuildRoleUpdate(s *discordgo.Session, r *discordgo.GuildRoleUpdate)

GuildRoleUpdate ...

func (*Bot) Prefix

func (b *Bot) Prefix(guildID string) string

Prefix gets the prefix for the given guild

type Cache

type Cache struct {
	Cache *ttlcache.Cache
	// contains filtered or unexported fields
}

Cache ...

type MemberCache

type MemberCache struct {
	*Cache
}

MemberCache ...

func (*MemberCache) Add

func (c *MemberCache) Add(gID, mID string, m *discordgo.Member)

Add manually adds a member to the cache

func (*MemberCache) AddNoExpire

func (c *MemberCache) AddNoExpire(gID, mID string, m *discordgo.Member)

AddNoExpire adds a member to the cache, with no expire time

func (*MemberCache) ForceGet

func (c *MemberCache) ForceGet(gID, mID string) (m *discordgo.Member, err error)

ForceGet forces a cache refresh for a member

func (*MemberCache) Get

func (c *MemberCache) Get(gID, mID string) (m *discordgo.Member, err error)

Get ...

func (*MemberCache) Remove

func (c *MemberCache) Remove(gID, mID string) (err error)

Remove ...

type RoleCache

type RoleCache struct {
	*Cache
}

RoleCache ...

func (*RoleCache) Add

func (c *RoleCache) Add(gID, mID string, m *discordgo.Role)

Add manually adds a member to the cache

func (*RoleCache) AddNoExpire

func (c *RoleCache) AddNoExpire(gID, rID string, r *discordgo.Role)

AddNoExpire adds a member to the cache, with no expire time

func (*RoleCache) ForceGet

func (c *RoleCache) ForceGet(gID, mID string) (r *discordgo.Role, err error)

ForceGet forces a cache refresh for a member

func (*RoleCache) Get

func (c *RoleCache) Get(gID, rID string) (r *discordgo.Role, err error)

Get ...

func (*RoleCache) Remove

func (c *RoleCache) Remove(gID, rID string) (err error)

Remove ...

type UserCache

type UserCache struct {
	*Cache
}

UserCache ...

Jump to

Keyboard shortcuts

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