idols

package
v0.0.0-...-07de05f Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHECKMARK_EMOJI    = "✅"
	X_EMOJI            = "❌"
	QUESTIONMARK_EMOJI = "❓"
	NAV_NUMBERS_EMOJI  = "🔢"

	MAX_IMAGE_SIZE      = 2000 // 2000x2000px
	MIN_IMAGE_SIZE      = 150  // 150x150px
	IMAGE_RESIZE_HEIGHT = 150
)
View Source
const (
	ALL_IDOLS_CACHE_KEY = "allidols"
)
View Source
const (
	GROUP_ALIAS_KEY = "groupAliases"
)

Variables

This section is empty.

Functions

func GetAlisesForGroup

func GetAlisesForGroup(targetGroup string) (bool, []string)

getAlisesForGroup gets the aliases for a group if it exists.

first return will be false if the group was not found

func GetMatchingGroup

func GetMatchingGroup(searchGroup string, activeOnly bool) (bool, string)

getMatchingGroup will do a loose comparison of the group name to see if it exists return 1: if a matching group exists return 2: what the real group name is

func RefreshAllIdolBiasgameStats

func RefreshAllIdolBiasgameStats(msg *discordgo.Message)

RefreshIdolBiasgameStats is a slow operation that will check every game the idol has ever been in and update its game stats

func RefreshIdolBiasgameStats

func RefreshIdolBiasgameStats(targetIdol *Idol)

RefreshIdolBiasgameStats is a slow operation that will check every game the idol has ever been in and update its game stats

func UpdateIdolGameStats

func UpdateIdolGameStats(game models.BiasGameEntry)

UpdateIdolGameStats is called every time a biasgame finished

Types

type Idol

type Idol struct {
	ID           bson.ObjectId
	Name         string
	NameAliases  []string
	GroupName    string
	Gender       string
	NameAndGroup string
	Images       []IdolImage
	Deleted      bool
	BGGames      int
	BGGameWins   int
	BGRounds     int
	BGRoundWins  int
}

func GetActiveIdols

func GetActiveIdols() []*Idol

GetActiveIdols will return only active idols and idols with images

func GetAllIdols

func GetAllIdols() []*Idol

GetAllIdols getter for all idols

func GetMatchingIdolAndGroup

func GetMatchingIdolAndGroup(searchGroup, searchName string, activeOnly bool) (bool, bool, *Idol)

GetMatchingIdolAndGroup will do a loose comparison of the name and group passed to the ones that already exist

1st return is true if group exists
2nd return is true if idol exists in the group
3rd will be a reference to the matching idol

func GetMatchingIdolById

func GetMatchingIdolById(id bson.ObjectId) *Idol

GetMatchingIdolById will get a matching idol based on the given id, will return nil if non is found

func (*Idol) GetRandomImage

func (i *Idol) GetRandomImage() image.Image

GetRandomImage returns a random idol image

func (*Idol) GetResizedRandomImage

func (i *Idol) GetResizedRandomImage(resize int) image.Image

GetResizedRandomImage returns a random image that has been resized

type IdolImage

type IdolImage struct {
	ImageBytes []byte
	HashString string
	ObjectName string
}

func (IdolImage) GetImgBytes

func (i IdolImage) GetImgBytes() []byte

GetImgBytes will get the bytes for the image with a default size of 150x150

func (IdolImage) GetResizeImgBytes

func (i IdolImage) GetResizeImgBytes(resizeHeight int) []byte

GetImageBytesWithResize will get the bytes to the correctly sized image bytes

type Module

type Module struct{}

module struct

func (*Module) Action

func (i *Module) Action(command string, content string, msg *discordgo.Message, session *discordgo.Session)

Main Entry point for the plugin

func (*Module) Commands

func (i *Module) Commands() []string

Will validate if the passed command entered is used for this plugin

func (*Module) Init

func (i *Module) Init(session *shardmanager.Manager)

func (*Module) OnGuildBanAdd

func (i *Module) OnGuildBanAdd(user *discordgo.GuildBanAdd, session *discordgo.Session)

func (*Module) OnGuildBanRemove

func (i *Module) OnGuildBanRemove(user *discordgo.GuildBanRemove, session *discordgo.Session)

func (*Module) OnGuildMemberAdd

func (i *Module) OnGuildMemberAdd(member *discordgo.Member, session *discordgo.Session)

func (*Module) OnGuildMemberRemove

func (i *Module) OnGuildMemberRemove(member *discordgo.Member, session *discordgo.Session)

func (*Module) OnMessage

func (i *Module) OnMessage(content string, msg *discordgo.Message, session *discordgo.Session)

/// Unused functions requried by ExtendedPlugin interface

func (*Module) OnMessageDelete

func (i *Module) OnMessageDelete(msg *discordgo.MessageDelete, session *discordgo.Session)

func (*Module) OnReactionAdd

func (i *Module) OnReactionAdd(reaction *discordgo.MessageReactionAdd, session *discordgo.Session)

Called whenever a reaction is added to any message

func (*Module) OnReactionRemove

func (i *Module) OnReactionRemove(reaction *discordgo.MessageReactionRemove, session *discordgo.Session)

func (*Module) Uninit

func (i *Module) Uninit(session *shardmanager.Manager)

Uninit called when bot is shutting down

Jump to

Keyboard shortcuts

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