Documentation
¶
Index ¶
- Constants
- func DropEmbed(ctx context.Context, char MediaCharacter) (corde.Message, func())
- func New(b *Bot) *corde.Mux
- type AnimeSearcher
- type Bot
- func (b *Bot) RegisterCommands() error
- func (b *Bot) RemoveUnknownCommands(ctx context.Context, r corde.ResponseWriter, ...)
- func (b *Bot) SearchAnime(ctx context.Context, w corde.ResponseWriter, ...)
- func (b *Bot) SearchChar(ctx context.Context, w corde.ResponseWriter, ...)
- func (b *Bot) SearchManga(ctx context.Context, w corde.ResponseWriter, ...)
- func (b *Bot) SearchUser(ctx context.Context, w corde.ResponseWriter, ...)
- type CharSearcher
- type Character
- type Interacter
- type MangaSearcher
- type Media
- type MediaCharacter
- type Profile
- type RandomCharer
- type Store
- type TrackerUser
- type TrackingService
- type User
- type UserSearcher
Constants ¶
View Source
const ( AnilistColor = 0x02a9ff AnilistIconURL = "https://anilist.co/img/icons/favicon-32x32.png" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AnimeSearcher ¶
type Bot ¶
type Bot struct {
Store Store
AnimeService TrackingService
Inter Interacter
AppID corde.Snowflake
GuildID *corde.Snowflake
BotToken string
PublicKey string
RollCooldown time.Duration
InteractionNeeded int64
TokensNeeded int32
// contains filtered or unexported fields
}
Bot holds the bot state
func (*Bot) RegisterCommands ¶
This init is called when ran with the build tag.
func (*Bot) RemoveUnknownCommands ¶
func (b *Bot) RemoveUnknownCommands(ctx context.Context, r corde.ResponseWriter, i *corde.Interaction[corde.JsonRaw])
func (*Bot) SearchAnime ¶
func (b *Bot) SearchAnime(ctx context.Context, w corde.ResponseWriter, i *corde.Interaction[corde.SlashCommandInteractionData])
func (*Bot) SearchChar ¶
func (b *Bot) SearchChar(ctx context.Context, w corde.ResponseWriter, i *corde.Interaction[corde.SlashCommandInteractionData])
func (*Bot) SearchManga ¶
func (b *Bot) SearchManga(ctx context.Context, w corde.ResponseWriter, i *corde.Interaction[corde.SlashCommandInteractionData])
func (*Bot) SearchUser ¶
func (b *Bot) SearchUser(ctx context.Context, w corde.ResponseWriter, i *corde.Interaction[corde.SlashCommandInteractionData])
type CharSearcher ¶
type CharSearcher interface {
Character(context.Context, string) ([]MediaCharacter, error)
}
type Interacter ¶
type Interacter interface {
GetInteractionCount(ctx context.Context, channelID corde.Snowflake) (int64, error)
ResetInteractionCount(ctx context.Context, channelID corde.Snowflake) error
IncrementInteractionCount(ctx context.Context, channelID corde.Snowflake) error
SetChannelChar(ctx context.Context, channelID corde.Snowflake, char MediaCharacter) error
GetChannelChar(ctx context.Context, channelID corde.Snowflake) (MediaCharacter, error)
RemoveChannelChar(ctx context.Context, channelID corde.Snowflake) error
}
Interacter
type MangaSearcher ¶
type Media ¶
type Media struct {
Title string
URL string
CoverImageURL string
BannerImageURL string
CoverImageColor uint32
Description string
}
Media represents an anime or manga.
type MediaCharacter ¶
type RandomCharer ¶
type RandomCharer interface {
RandomChar(ctx context.Context, notIn ...int64) (MediaCharacter, error)
}
type Store ¶
type Store interface {
PutChar(context.Context, corde.Snowflake, Character) error
Chars(context.Context, corde.Snowflake) ([]Character, error)
VerifyChar(context.Context, corde.Snowflake, int64) (Character, error)
CharsIDs(ctx context.Context, userID corde.Snowflake) ([]int64, error)
DeleteChar(context.Context, corde.Snowflake, int64) (Character, error)
CharsStartingWith(context.Context, corde.Snowflake, string) ([]Character, error)
User(context.Context, corde.Snowflake) (User, error)
Profile(context.Context, corde.Snowflake) (Profile, error)
SetUserDate(context.Context, corde.Snowflake, time.Time) error
SetUserFavorite(context.Context, corde.Snowflake, int64) error
SetUserQuote(context.Context, corde.Snowflake, string) error
SetUserAnilistURL(context.Context, corde.Snowflake, string) error
GiveUserChar(ctx context.Context, dst corde.Snowflake, src corde.Snowflake, charID int64) error
AddDropToken(context.Context, corde.Snowflake) error
ConsumeDropTokens(context.Context, corde.Snowflake, int32) (User, error)
Tx(fn func(s Store) error) error
}
Store is the database
type TrackerUser ¶
TrackerUser represents an anime tracker user.
type TrackingService ¶
type TrackingService interface {
RandomCharer
AnimeSearcher
CharSearcher
MangaSearcher
UserSearcher
}
TrackingService is the interface for the anilist service
type UserSearcher ¶
type UserSearcher interface {
User(context.Context, string) ([]TrackerUser, error)
}
Click to show internal directories.
Click to hide internal directories.