Documentation ¶
Index ¶
- Constants
- func AddEmbedFooter(msg *disgord.Message) (f *disgord.EmbedFooter, t disgord.Time)
- func BrandImage(dc *gg.Context)
- func CanRun(ctx atlas.Context) bool
- func Check(err error)
- func CheckStar(sURL string) bool
- func DrawStringWithShadow(s string, x float64, y float64, dc *gg.Context)
- func DrawWrappedStringWithShadow(s string, x float64, y float64, ax float64, ay float64, width float64, ...)
- func GenAvatarURL(user *disgord.User) stringdeprecated
- func GenerateMessageURL(guildID disgord.Snowflake, msg *disgord.Message) string
- func GetArtistImage(artist Artist) image.Image
- func GetArtistImageFromFmArtist(artist lastfm.ArtistGetInfo) image.Image
- func GetArtistImageURL(artist Artist) string
- func GetArtistImageURLFromFmArtist(artist lastfm.ArtistGetInfo) string
- func GetAvatarImage(user *disgord.User) (image.Image, *os.File)
- func GetDiscordIDFromMention(mention string) (ID disgord.Snowflake, err error)
- func GetExt(filename string) string
- func GetLastfmUserInfo(user *disgord.User, lfm *lastfm.API) (lastfm.UserGetInfo, error)
- func GetUInt64ID(user *disgord.User) uint64
- func Grab(sURL string) (res *grab.Response, err error)
- func HTMLParse(s string) string
- func HumanNumber(i interface{}) string
- func IsMention(mention string) bool
- func JoinString(strs []string, char string) string
- func JoinStringMap(strs map[int]string, char string) string
- func LocGet(file string) string
- func Migrate()
- func OpenDB() (*genmai.DB, error)
- func OpenImage(filename string) (image.Image, *os.File)
- func RandomColor() int
- func RegisterEvents(client *atlas.Atlas)
- func SaveImage(dc *gg.Context, ctx atlas.Context, name string) (*os.File, error)
- func ShortStr(str string, n int, els ...string) string
- func SnowflakeToUInt64(snowflake disgord.Snowflake) uint64
- func Storage() string
- func StrToSnowflake(str string) disgord.Snowflake
- func TagImageName(ctx atlas.Context, name string) string
- func UInt64ToSnowflake(i uint64) disgord.Snowflake
- func Ucwords(str string) string
- type AlbumPosition
- type Artist
- type ArtistImages
- type Artists
- type Configuration
- type Crowns
- type InfoText
- type MaArtist
- type PlaysText
- type Servers
- type Shadow
- type Time
- type TrackPosition
- type Users
Constants ¶
const ( // NoArtistURL is the URL to a blank image for no artist images found // on metal archives. NoArtistURL = "https://cdn.persephonebot.net/images/bm.png" // LfmStarImage is the image name for the default Last.fm star pic. LfmStarImage = "2a96cbd8b46e442fc41c2b86b821562f.png" )
Variables ¶
This section is empty.
Functions ¶
func AddEmbedFooter ¶
AddEmbedFooter returns a footer and timestamp for disgord embeds
func BrandImage ¶
BrandImage tags an image with a discord link and bot's name
func DrawStringWithShadow ¶
DrawStringWithShadow draws a string with text shadow.
func DrawWrappedStringWithShadow ¶
func DrawWrappedStringWithShadow(s string, x float64, y float64, ax float64, ay float64, width float64, lineSpacing float64, align gg.Align, dc *gg.Context)
DrawWrappedStringWithShadow draws a wrapped string with text shadow.
func GenAvatarURL
deprecated
func GenerateMessageURL ¶
GenerateMessageURL returns the URL for a specific Discord message.
func GetArtistImage ¶
GetArtistImage scrapes metal-archives for an artist image.
func GetArtistImageFromFmArtist ¶
GetArtistImageFromFmArtist scrapes metal-archives for an artist image.
func GetArtistImageURL ¶
GetArtistImageURL returns the URL for an artist scraped from metal-archives.
func GetArtistImageURLFromFmArtist ¶
func GetArtistImageURLFromFmArtist(artist lastfm.ArtistGetInfo) string
GetArtistImageURLFromFmArtist returns the URL for an artist scraped from metal-archives.
func GetAvatarImage ¶
GetAvatarImage returns an image.Image of a user's avatar.
func GetDiscordIDFromMention ¶
GetDiscordIDFromMention gets the snowflake id from a mention.
func GetLastfmUserInfo ¶
GetLastfmUserInfo gets user info from last.fm.
func GetUInt64ID ¶
GetUInt64ID returns a uint64 version of the Discord user ID.
func HumanNumber ¶
func HumanNumber(i interface{}) string
HumanNumber converts a number into a human readable one.
func JoinString ¶
JoinString joins a string slice with a char, and removes the end char.
func JoinStringMap ¶
JoinStringMap joins a string map with a char, and removes the end char.
func RegisterEvents ¶
RegisterEvents registers any client events.
func SnowflakeToUInt64 ¶
SnowflakeToUInt64 returns a uint64 version of a snowflake.
func Storage ¶
func Storage() string
Storage returns storage locations for configuration and static folders
func StrToSnowflake ¶
StrToSnowflake returns a Snowflake from a string.
func TagImageName ¶
TagImageName generates an image filename to uniquely identify it.
func UInt64ToSnowflake ¶
UInt64ToSnowflake converts a uint64 to a snowflake.
Types ¶
type AlbumPosition ¶
AlbumPosition holds album art positions.
type Artist ¶
type Artist struct { Rank string `xml:"rank,attr"` Name string `xml:"name"` PlayCount string `xml:"playcount"` Mbid string `xml:"mbid"` URL string `xml:"url"` Streamable string `xml:"streamable"` Images []struct { Size string `xml:"size,attr"` URL string `xml:",chardata"` } `xml:"image"` }
Artist holds simple artist info.
type ArtistImages ¶
ArtistImages object.
type Artists ¶
type Artists []struct { Rank string `xml:"rank,attr"` Name string `xml:"name"` PlayCount string `xml:"playcount"` Mbid string `xml:"mbid"` URL string `xml:"url"` Streamable string `xml:"streamable"` Images []struct { Size string `xml:"size,attr"` URL string `xml:",chardata"` } `xml:"image"` }
Artists holds simple artist info in slice format.
type Configuration ¶
type Configuration struct { Token string `yaml:"token"` BotOwner string `yaml:"bot_owner"` BotID string `yaml:"bot_id"` GuildID string `yaml:"guild_id"` LogChannelID string `yaml:"log_channel_id"` ElevatedRole string `yaml:"elevated_role"` Prefix string `yaml:"prefix"` // Starboard string `json:"starboard"` Starboard struct { Channel string `yaml:"channel"` ActivationCount int `yaml:"activation_count"` } `yaml:"starboard"` Lastfm struct { APIKey string `yaml:"apikey"` Secret string `yaml:"secret"` } `yaml:"lastfm"` Database struct { Hostname string `yaml:"hostname"` Port int `yaml:"port"` Username string `yaml:"username"` Password string `yaml:"password"` Name string `yaml:"name"` } `yaml:"database"` YouTube struct { APIKey string `yaml:"apikey"` } `yaml:"youtube"` Website struct { AppURL string `yaml:"app_url"` APIURL string `yaml:"api_url"` } `yaml:"website"` }
Configuration is the base yaml object.
func Config ¶
func Config() Configuration
Config retrieves the app's configuration form config.json.
type Crowns ¶
Crowns object.
func GetCrownsList ¶
func GetCrownsList() (crowns []Crowns)
GetCrownsList returns a list of all crowns in database.
func (Crowns) GetUserCrowns ¶
GetUserCrowns is a relational method that returns a list of crowns for a given user.
type MaArtist ¶
MaArtist is an artist struct for metal-archives artist
func GetMaArtist ¶
GetMaArtist returns an artist listed in artists.json for metal-archives
func GetMaArtistList ¶
func GetMaArtistList() []MaArtist
GetMaArtistList returns a list of artists defined in artists.json for metal-archives
type Servers ¶
type Servers struct { ID int64 `db:"pk"` GuildID uint64 LogChannelID uint64 ElevatedRole uint64 Time }
Servers object.
type TrackPosition ¶
TrackPosition holds track label positions.
type Users ¶
type Users struct { ID int64 `db:"pk"` Username string Email string DiscordID uint64 `db:"unique"` DiscordToken string DiscordRefreshToken string Lastfm string LastfmToken string RememberToken *string Time }
Users object.
func GetUserFromString ¶
GetUserFromString returns a user from a string username.
func (Users) GetDiscordID ¶
GetDiscordID returns a discord ID snowflake.