Documentation ¶
Index ¶
- Constants
- func GetPlayerByName(name string) string
- func Greetings(discord *discordgo.Session, event *discordgo.GuildMemberAdd, guild *GuildData)
- func SendKill(session *discordgo.Session, conf *Config, kill *AlbionKill, ...)
- func SendPlayerKills(session *discordgo.Session, worker *DBWorker, conf *Config, ...)
- type AlbionEquipment
- type AlbionGuildSearch
- type AlbionItem
- type AlbionKill
- type AlbionPlayer
- type AlbionPlayerSearch
- type AlbionPlayerUpdater
- type AlbionSearchResult
- type AlbionUpdater
- type BlackListElement
- type BlackListStruct
- type BotMessages
- type CmdMap
- type Command
- type CommandHandler
- type CommandSignature
- type Config
- type Connection
- type Context
- func (ctx *Context) AddGreetings(text string)
- func (ctx *Context) AlbionAddPlayer() error
- func (ctx *Context) AlbionShowKill()
- func (ctx *Context) AlbionShowKills()
- func (ctx *Context) Arg(index int) string
- func (ctx *Context) BlacklistAddGuild(id string)
- func (ctx *Context) BlacklistAddUser(id string)
- func (ctx *Context) BlacklistRemoveGuild(id string)
- func (ctx *Context) BlacklistRemoveUser(id string)
- func (ctx *Context) EditEmbed(ID, name, value string, inline bool)
- func (ctx *Context) GetGuild() *GuildData
- func (ctx *Context) GetGuildUser(id string) *discordgo.User
- func (ctx *Context) GetRoles() *UserRoles
- func (ctx *Context) GetVoiceChannel() *discordgo.Channel
- func (ctx *Context) GuildConf() *GuildData
- func (ctx *Context) IsAdmin() bool
- func (ctx *Context) IsServerAdmin() bool
- func (ctx *Context) Loc(key string) string
- func (ctx *Context) Log(module, guildID, text string)
- func (ctx *Context) MetricsCommand(command, state string)
- func (ctx *Context) MetricsLog(module string)
- func (ctx *Context) MetricsMessage()
- func (ctx *Context) RemoveGreetings()
- func (ctx *Context) Reply(content string) *discordgo.Message
- func (ctx *Context) ReplyEmbed(name, content string) *discordgo.Message
- func (ctx *Context) ReplyEmbedAttachment(name, content, fileName string, file io.Reader) *discordgo.Message
- func (ctx *Context) ReplyEmbedAttachmentImageURL(title, desc, imageUrl string) *discordgo.Message
- func (ctx *Context) ReplyEmbedPM(name, content string) *discordgo.Message
- func (ctx *Context) ReplyFile(name string, r io.Reader) *discordgo.Message
- func (ctx *Context) ReplyPM(content string) *discordgo.Message
- func (ctx *Context) WeatherCode(code string) string
- type CurrencyConfig
- type DBLConfig
- type DBWorker
- func (db *DBWorker) AddAlbionPlayer(player *AlbionPlayerUpdater)
- func (db *DBWorker) AddBlacklistGuild(id string)
- func (db *DBWorker) AddBlacklistUser(id string)
- func (db *DBWorker) AddRadioStation(name, url, key, category string) error
- func (db *DBWorker) AddStream(stream *TwitchStream)
- func (db *DBWorker) GetAlbionPlayers() []AlbionPlayerUpdater
- func (db *DBWorker) GetBlacklist() *BlackListStruct
- func (db *DBWorker) GetNewsCountry(guild string) string
- func (db *DBWorker) GetRadioStationByKey(key string) (*RadioStation, error)
- func (db *DBWorker) GetRadioStations(category string) []RadioStation
- func (db *DBWorker) GetTwitchStreams(guildID string) map[string]*TwitchStream
- func (db *DBWorker) GetTwitchToken() *TwitchDBConfig
- func (db *DBWorker) Guilds() *mgo.Collection
- func (db *DBWorker) InitGuilds(sess *discordgo.Session, conf *Config) *GuildsMap
- func (db *DBWorker) InitNewGuild(guildID string, conf *Config, data *GuildsMap)
- func (db *DBWorker) Log(module, guildID, text string)
- func (db *DBWorker) LogGet(count int) []dbLog
- func (db *DBWorker) RemoveAlbionPlayer(id string)
- func (db *DBWorker) RemoveBlacklistGuild(id string)
- func (db *DBWorker) RemoveBlacklistUser(id string)
- func (db *DBWorker) RemoveRadioStation(key string) error
- func (db *DBWorker) RemoveStream(stream *TwitchStream)
- func (db *DBWorker) UpdateAlbionPlayerLast(userID string, lastKill int64)
- func (db *DBWorker) UpdateStream(stream *TwitchStream)
- func (db *DBWorker) UpdateTwitchToken(token string, expire time.Time)
- type DarkSkyConfig
- type DataType
- func (data *DataType) AddCronJob(ctx *Context, id cron.EntryID, cmd string) error
- func (data *DataType) AddPollVote(ctx *Context, vote int) error
- func (data *DataType) CreatePoll(ctx *Context, fields []string) error
- func (data *DataType) CronIsFull(ctx *Context) bool
- func (data *DataType) CronList(ctx *Context) (*GuildSchedule, error)
- func (data *DataType) CronRemove(ctx *Context, id cron.EntryID) error
- func (data *DataType) EndPoll(ctx *Context) (results map[string]int, err error)
- type GeneralConfig
- type GuildData
- type GuildSchedule
- type GuildsMap
- type JoinProperties
- type LocalesMap
- type MetricsConfig
- type NewEmbedStruct
- func (emb *NewEmbedStruct) AttachImg(name string, file io.Reader) *NewEmbedStruct
- func (emb *NewEmbedStruct) AttachImgURL(url string) *NewEmbedStruct
- func (emb *NewEmbedStruct) AttachThumbURL(url string) *NewEmbedStruct
- func (emb *NewEmbedStruct) Author(name, url, iconURL string) *NewEmbedStruct
- func (emb *NewEmbedStruct) CheckLength(newLength int) bool
- func (emb *NewEmbedStruct) Color(color int) *NewEmbedStruct
- func (emb *NewEmbedStruct) Desc(desc string) *NewEmbedStruct
- func (emb *NewEmbedStruct) Field(name, value string, inline bool) *NewEmbedStruct
- func (emb *NewEmbedStruct) Footer(text string) *NewEmbedStruct
- func (emb *NewEmbedStruct) GetEmbed() *discordgo.MessageEmbed
- func (emb *NewEmbedStruct) Send(ctx *Context) *discordgo.Message
- func (emb *NewEmbedStruct) SendPM(ctx *Context) *discordgo.Message
- func (emb *NewEmbedStruct) TimeStamp(ts string) *NewEmbedStruct
- func (emb *NewEmbedStruct) URL(url string) *NewEmbedStruct
- type NewsConfig
- type NodeElement
- type NodeTree
- type NodeWorker
- type PlaylistVideo
- type PollType
- type RadioPlayer
- type RadioStation
- type Session
- type SessionManager
- func (manager *SessionManager) Count() int
- func (manager *SessionManager) GetAll() map[string]*Session
- func (manager *SessionManager) GetByChannel(channelID string) (*Session, bool)
- func (manager *SessionManager) GetByGuild(guildID string) *Session
- func (manager *SessionManager) GetChannels() []string
- func (manager *SessionManager) GetGuilds() []string
- func (manager *SessionManager) Join(discord *discordgo.Session, guildID, channelID string, ...) (*Session, error)
- func (manager *SessionManager) Leave(discord *discordgo.Session, session Session)
- type Song
- type SongQueue
- func (queue *SongQueue) Add(song *Song)
- func (queue *SongQueue) Clear()
- func (queue *SongQueue) Current() *Song
- func (queue *SongQueue) Get() []Song
- func (queue *SongQueue) HasNext() bool
- func (queue *SongQueue) Next() Song
- func (queue *SongQueue) Pause()
- func (queue *SongQueue) Set(list []Song)
- func (queue SongQueue) Start(sess *Session, callback func(string))
- type TranslateConfig
- type Twitch
- type TwitchConfig
- type TwitchDBConfig
- type TwitchGameData
- type TwitchGameResult
- type TwitchGuild
- type TwitchStream
- type TwitchStreamData
- type TwitchStreamResult
- type TwitchUserData
- type TwitchUserResult
- type UserRoles
- type VideoResult
- type VoiceConfig
- type WeatherCodesMap
- type WeatherConfig
- type YTSearchContent
- type Youtube
Constants ¶
const ( // CHANNELS count of audio channels CHANNELS int = 2 // FRAME_RATE ... FRAME_RATE int = 48000 // FRAME_SIZE ... FRAME_SIZE int = 960 // MAX_BYTES max bytes per sample MAX_BYTES int = (FRAME_SIZE * 2) * 2 )
const ( // ERROR_TYPE returns if error ERROR_TYPE = -1 // VIDEO_TYPE returns if video VIDEO_TYPE = 0 // PLAYLIST_TYPE returns if playlist PLAYLIST_TYPE = 1 )
Variables ¶
This section is empty.
Functions ¶
func GetPlayerByName ¶
GetPlayerByID returns player ID by player name
func Greetings ¶
func Greetings(discord *discordgo.Session, event *discordgo.GuildMemberAdd, guild *GuildData)
Greetings sends greetings for user
func SendKill ¶
func SendKill(session *discordgo.Session, conf *Config, kill *AlbionKill, userID, lang string)
SendKill sends kill to user
func SendPlayerKills ¶
func SendPlayerKills(session *discordgo.Session, worker *DBWorker, conf *Config, updater *AlbionUpdater, userID string)
SendPlayerKills sends player kills
Types ¶
type AlbionEquipment ¶
type AlbionEquipment struct { MainHand AlbionItem `json:"MainHand"` OffHand AlbionItem `json:"OffHand"` Head AlbionItem `json:"Head"` Armor AlbionItem `json:"Armor"` Shoes AlbionItem `json:"Shoes"` Bag AlbionItem `json:"Bag"` Cape AlbionItem `json:"Cape"` Mount AlbionItem `json:"Mount"` Potion AlbionItem `json:"Potion"` Food AlbionItem `json:"Food"` }
Equipment contains items in slots
type AlbionGuildSearch ¶
type AlbionGuildSearch struct { ID string `json:"Id"` Name string `json:"Name"` AllianceID string `json:"AllianceId"` AllianceName string `json:"AllianceName"` KillFame int `json:"KillFame"` DeathFame int `json:"DeathFame"` }
GuildSearch contains guild data from search response
type AlbionItem ¶
type AlbionItem struct { Type string `json:"Type"` Count int `json:"Count"` Quality int `json:"Quality"` }
Item contains item data
type AlbionKill ¶
type AlbionKill struct { GroupMemberCount int `json:"groupMemberCount"` NumberOfParticipants int `json:"numberOfParticipants"` EventID int `json:"EventId"` TimeStamp string `json:"TimeStamp"` Version int `json:"Version"` Killer AlbionPlayer `json:"Killer"` Victim AlbionPlayer `json:"Victim"` TotalVictimKillFame int `json:"TotalVictimKillFame"` Location string `json:"Location"` Participants []AlbionPlayer `json:"Participants"` GroupMembers []AlbionPlayer `json:"GroupMembers"` BattleID int `json:"BattleId"` Type string `json:"Type"` }
Kill contains kill data
func AlbionGetKillID ¶
func AlbionGetKillID(id string) (kill *AlbionKill, err error)
AlbionGetKillID returns kill by ID
func AlbionGetPlayerKills ¶
func AlbionGetPlayerKills(id string) (result []AlbionKill, err error)
GetPlayerKills returns array of kills by player id
type AlbionPlayer ¶
type AlbionPlayer struct { AverageItemPower float64 `json:"AverageItemPower"` Equipment AlbionEquipment `json:"Equipment"` Inventory []AlbionItem `json:"Inventory"` Name string `json:"Name"` Id string `json:"Id"` GuildName string `json:"GuildName"` GuildId string `json:"GuildId"` AllianceName string `json:"AllianceName"` AllianceId string `json:"AllianceId"` AllianceTag string `json:"AllianceTag"` Avatar string `json:"Avatar"` AvatarRing string `json:"AvatarRing"` DeathFame int `json:"DeathFame"` KillFame int `json:"KillFame"` FameRatio float64 `json:"FameRatio"` DamageDone float64 `json:"DamageDone"` }
Player data
type AlbionPlayerSearch ¶
type AlbionPlayerSearch struct { ID string `json:"Id"` Name string `json:"Name"` AllianceID string `json:"AllianceId"` AllianceName string `json:"AllianceName"` KillFame int `json:"KillFame"` DeathFame int `json:"DeathFame"` Avatar string `json:"Avatar"` AvatarRing string `json:"AvatarRing"` FameRation float64 `json:"FameRatio"` TotalKills int `json:"totalKills"` GVGKills int `json:"gvgKills"` GVGWon int `json:"gvgWon"` }
PlayerSearch contains player data from search response
type AlbionPlayerUpdater ¶
type AlbionSearchResult ¶
type AlbionSearchResult struct { Guilds []AlbionGuildSearch `json:"guilds"` Players []AlbionPlayerSearch `json:"players"` }
SearchResult contains search response
func AlbionSearchPlayers ¶
func AlbionSearchPlayers(name string) (result *AlbionSearchResult, err error)
SearchPlayers returns player list by name
type AlbionUpdater ¶
type AlbionUpdater struct {
Players map[string]*AlbionPlayerUpdater
}
func AlbionGetUpdater ¶
func AlbionGetUpdater(db *DBWorker) *AlbionUpdater
AlbionGetUpdater creates and returns albion kills updater
type BlackListElement ¶
type BlackListElement struct {
ID string
}
type BlackListStruct ¶
BlackList contains ignored guilds and users
func (BlackListStruct) CheckGuild ¶
func (b BlackListStruct) CheckGuild(id string) bool
CheckGuild returns true if guild in blacklist
func (BlackListStruct) CheckUser ¶
func (b BlackListStruct) CheckUser(id string) bool
CheckUser returns true if user in blacklist
type BotMessages ¶
BotMessages contains map with key = guild ID, value = array of messages IDs
func NewMessagesMap ¶
func NewMessagesMap() *BotMessages
NewMessagesMap creates map of bot's messages
func (*BotMessages) Add ¶
func (m *BotMessages) Add(ctx *Context, messageID string)
Add adds bot message to index
func (*BotMessages) Clear ¶
func (m *BotMessages) Clear(ctx *Context, from int)
Clear deletes bot messages
type CommandHandler ¶
type CommandHandler struct {
// contains filtered or unexported fields
}
CommandHandler : Command handler struct
func NewCommandHandler ¶
func NewCommandHandler() *CommandHandler
NewCommandHandler creates command handler
func (CommandHandler) Get ¶
func (handler CommandHandler) Get(name string) (*Command, bool)
Get returns command by command name
func (CommandHandler) GetCmds ¶
func (handler CommandHandler) GetCmds() CmdMap
GetCmds returns handler commands
func (CommandHandler) Register ¶
func (handler CommandHandler) Register(name string, command Command)
Register adds new command in handler
type CommandSignature ¶
type CommandSignature struct { Path []string Command func(Context) Middlewares []func(*Context) bool }
CommandSignature contains data of command
type Config ¶
type Config struct { Weather WeatherConfig General GeneralConfig News NewsConfig Translate TranslateConfig Locales LocalesMap Currency CurrencyConfig WeatherCodes WeatherCodesMap Metrics MetricsConfig DBL DBLConfig Twitch TwitchConfig DarkSky DarkSkyConfig Voice VoiceConfig }
Config Main config struct. Contains all another config structs data.
func LoadConfig ¶
func LoadConfig() *Config
LoadConfig loads configs from file 'config.toml'. Terminate program if error.
func (*Config) GetLocaleLang ¶
GetLocaleLang returns translation on specified language
func (*Config) LoadLocales ¶
func (c *Config) LoadLocales()
LoadLocales loads locales from file 'locales.json'. Terminate program if error.
func (*Config) LoadWeatherCodes ¶
func (c *Config) LoadWeatherCodes()
LoadWeatherCodes loads weather font codes from file 'codes.json' in map. Terminate program if error.
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection : Voice connection struct
func NewConnection ¶
func NewConnection(voiceConnection *discordgo.VoiceConnection) *Connection
NewConnection creates and returns new voice connection
func (*Connection) Disconnect ¶
func (c *Connection) Disconnect()
Disconnect remove from voice channel and connection
func (*Connection) EncodeOpusAndSend ¶
func (connection *Connection) EncodeOpusAndSend(reader io.Reader) error
type Context ¶
type Context struct { BotID string Discord *discordgo.Session Guild *discordgo.Guild VoiceChannel *discordgo.Channel TextChannel *discordgo.Channel User *discordgo.User Message *discordgo.MessageCreate Args []string DB *DBWorker Cron *cron.Cron Conf *Config CmdHandler *CommandHandler Sessions *SessionManager Youtube *Youtube BotMsg *BotMessages Data *DataType Guilds *GuildsMap Twitch *Twitch Albion *AlbionUpdater BlackList *BlackListStruct }
Context : Bot context structure
func NewContext ¶
func NewContext(botID string, discord *discordgo.Session, guild *discordgo.Guild, textChannel *discordgo.Channel, user *discordgo.User, message *discordgo.MessageCreate, conf *Config, cmdHandler *CommandHandler, sessions *SessionManager, youtube *Youtube, botMsg *BotMessages, dataType *DataType, dbWorker *DBWorker, guilds *GuildsMap, botCron *cron.Cron, twitch *Twitch, albion *AlbionUpdater, blacklist *BlackListStruct) *Context
NewContext create new context
func (*Context) AddGreetings ¶
AddGreetings adds new greetings to guild
func (*Context) AlbionAddPlayer ¶
AlbionAddPlayer adds player to updater
func (*Context) AlbionShowKill ¶
func (ctx *Context) AlbionShowKill()
AlbionShowKill sends kill embed to user
func (*Context) AlbionShowKills ¶
func (ctx *Context) AlbionShowKills()
ShowKills sends embed message in discord
func (*Context) BlacklistAddGuild ¶
BlacklistAddGuild adds guild in blacklist
func (*Context) BlacklistAddUser ¶
BlacklistAddUser adds user in blacklist
func (*Context) BlacklistRemoveGuild ¶
BlacklistRemoveGuild removes guild from blacklist
func (*Context) BlacklistRemoveUser ¶
BlacklistRemoveUser removes user from blacklist
func (*Context) GetVoiceChannel ¶
GetVoiceChannel returns user voice channel
func (*Context) IsServerAdmin ¶
func (*Context) MetricsCommand ¶
MetricsCommand sends command metrics
func (*Context) MetricsLog ¶
MetricsLog sends log metrics
func (*Context) MetricsMessage ¶
func (ctx *Context) MetricsMessage()
MetricsMessage sends message metrics
func (*Context) RemoveGreetings ¶
func (ctx *Context) RemoveGreetings()
RemoveGreetings removes greetings from guild
func (*Context) ReplyEmbed ¶
ReplyEmbed reply on message with embed message
func (*Context) ReplyEmbedAttachment ¶
func (ctx *Context) ReplyEmbedAttachment(name, content, fileName string, file io.Reader) *discordgo.Message
ReplyEmbedAttachment reply on message with embed message with attachment
func (*Context) ReplyEmbedAttachmentImageURL ¶
ReplyEmbedAttachment reply on message with embed message with attachment
func (*Context) ReplyEmbedPM ¶
ReplyEmbedPM sends embed in personal channel
func (*Context) WeatherCode ¶
WeatherCode returns unicode symbol of weather font icon
type CurrencyConfig ¶
type CurrencyConfig struct {
Default []string
}
CurrencyConfig Currency config struct
type DBWorker ¶
DBWorker MongoDB instance
func NewDBSession ¶
NewDBSession creates new MongoDB instance
func (*DBWorker) AddAlbionPlayer ¶
func (db *DBWorker) AddAlbionPlayer(player *AlbionPlayerUpdater)
AddAlbionPlayer adds new player in database
func (*DBWorker) AddBlacklistGuild ¶
AddBlacklistGuild adds guild in database blacklist
func (*DBWorker) AddBlacklistUser ¶
AddBlacklistUser adds user in database blacklist
func (*DBWorker) AddRadioStation ¶
AddRadioStation adds new radio station
func (*DBWorker) AddStream ¶
func (db *DBWorker) AddStream(stream *TwitchStream)
AddStream adds stream in mongodb
func (*DBWorker) GetAlbionPlayers ¶
func (db *DBWorker) GetAlbionPlayers() []AlbionPlayerUpdater
GetAlbionPlayers gets players from database
func (*DBWorker) GetBlacklist ¶
func (db *DBWorker) GetBlacklist() *BlackListStruct
GetBlackList gets blacklist from database
func (*DBWorker) GetNewsCountry ¶
GetNewsCountry returns news country string
func (*DBWorker) GetRadioStationByKey ¶
func (db *DBWorker) GetRadioStationByKey(key string) (*RadioStation, error)
GetRadioStationByKey returns one station by key
func (*DBWorker) GetRadioStations ¶
func (db *DBWorker) GetRadioStations(category string) []RadioStation
GetRadioStations gets stations from database and returns slice of them
func (*DBWorker) GetTwitchStreams ¶
func (db *DBWorker) GetTwitchStreams(guildID string) map[string]*TwitchStream
GetTwitchStreams returns twitch streams from mongodb
func (*DBWorker) GetTwitchToken ¶
func (db *DBWorker) GetTwitchToken() *TwitchDBConfig
func (*DBWorker) Guilds ¶
func (db *DBWorker) Guilds() *mgo.Collection
Guilds returns guilds collection from mongodb
func (*DBWorker) InitGuilds ¶
InitGuilds initialize guilds in database
func (*DBWorker) InitNewGuild ¶
InitNewGuild creates new guild in database
func (*DBWorker) RemoveAlbionPlayer ¶
RemoveAlbionPlayer removes player from database
func (*DBWorker) RemoveBlacklistGuild ¶
RemoveBlacklistGuild removes guild from database blacklist
func (*DBWorker) RemoveBlacklistUser ¶
RemoveBlacklistUser removes user from database blacklist
func (*DBWorker) RemoveRadioStation ¶
RemoveRadioStation removes radio station by key
func (*DBWorker) RemoveStream ¶
func (db *DBWorker) RemoveStream(stream *TwitchStream)
RemoveStream removes stream from mongodb
func (*DBWorker) UpdateAlbionPlayerLast ¶
UpdateAlbionPlayerLast updates last kill of albion player
func (*DBWorker) UpdateStream ¶
func (db *DBWorker) UpdateStream(stream *TwitchStream)
UpdateStream updates stream in mongodb
type DarkSkyConfig ¶
type DarkSkyConfig struct {
Token string
}
DarkSkyConfig Dark Sky weather api config
type DataType ¶
type DataType struct { Polls map[string]*PollType GuildSchedules map[string]*GuildSchedule }
DataType contains some data
func (*DataType) AddCronJob ¶
AddCronJob adds new cron job to guild
func (*DataType) AddPollVote ¶
AddPollVote votes in poll
func (*DataType) CreatePoll ¶
CreatePoll creates new poll in guild
func (*DataType) CronIsFull ¶
CronIsFull checks if cron jobs is maximum count
func (*DataType) CronList ¶
func (data *DataType) CronList(ctx *Context) (*GuildSchedule, error)
CronList shows cron jobs
func (*DataType) CronRemove ¶
CronRemove removes job from guild
type GeneralConfig ¶
type GeneralConfig struct { Language string Timezone int GeonamesUsername string Game string EmbedColor int ServiceURL string MessagePool int DatabaseName string GeocodingApiKey string AdminID string }
GeneralConfig General config struct
type GuildData ¶
type GuildData struct { ID string WeatherCity string NewsCounty string Language string Timezone int EmbedColor int VoiceVolume float32 Greeting string }
GuildData contains data about guild settings
type GuildSchedule ¶
type GuildSchedule struct {
CronJobs map[cron.EntryID]string
}
GuildSchedule contains map with cron jobs
type JoinProperties ¶
JoinProperties voice connection properties struct
type MetricsConfig ¶
MetricsConfig InfluxDB connection settings
type NewEmbedStruct ¶
type NewEmbedStruct struct { *discordgo.MessageSend // contains filtered or unexported fields }
NewEmbedStruct generated embed
func (*NewEmbedStruct) AttachImg ¶
func (emb *NewEmbedStruct) AttachImg(name string, file io.Reader) *NewEmbedStruct
AttachImg adds attached image to embed from io.Reader
func (*NewEmbedStruct) AttachImgURL ¶
func (emb *NewEmbedStruct) AttachImgURL(url string) *NewEmbedStruct
AttachImgURL adds attached image to embed from url
func (*NewEmbedStruct) AttachThumbURL ¶
func (emb *NewEmbedStruct) AttachThumbURL(url string) *NewEmbedStruct
AttachThumbURL adds attached thumbnail to embed from url
func (*NewEmbedStruct) Author ¶
func (emb *NewEmbedStruct) Author(name, url, iconURL string) *NewEmbedStruct
Author adds author to embed
func (*NewEmbedStruct) CheckLength ¶
func (emb *NewEmbedStruct) CheckLength(newLength int) bool
CheckLength returns true if length of embed chars less then 6000
func (*NewEmbedStruct) Color ¶
func (emb *NewEmbedStruct) Color(color int) *NewEmbedStruct
Color adds color to embed
func (*NewEmbedStruct) Desc ¶
func (emb *NewEmbedStruct) Desc(desc string) *NewEmbedStruct
Desc adds description to embed
func (*NewEmbedStruct) Field ¶
func (emb *NewEmbedStruct) Field(name, value string, inline bool) *NewEmbedStruct
Field adds field to embed
func (*NewEmbedStruct) Footer ¶
func (emb *NewEmbedStruct) Footer(text string) *NewEmbedStruct
Footer adds footer text
func (*NewEmbedStruct) GetEmbed ¶
func (emb *NewEmbedStruct) GetEmbed() *discordgo.MessageEmbed
GetEmbed returns discords embed
func (*NewEmbedStruct) Send ¶
func (emb *NewEmbedStruct) Send(ctx *Context) *discordgo.Message
Send send embed message to Discord
func (*NewEmbedStruct) SendPM ¶
func (emb *NewEmbedStruct) SendPM(ctx *Context) *discordgo.Message
SendPM send embed personal message to Discord
func (*NewEmbedStruct) TimeStamp ¶
func (emb *NewEmbedStruct) TimeStamp(ts string) *NewEmbedStruct
TimeStamp adds timestamp to footer of embed
func (*NewEmbedStruct) URL ¶
func (emb *NewEmbedStruct) URL(url string) *NewEmbedStruct
URL adds url to embed description
type NewsConfig ¶
NewsConfig News config struct
type NodeElement ¶
type NodeElement struct { Current string Elements map[string]*NodeElement Workers []NodeWorker }
func (*NodeElement) AddElement ¶
func (n *NodeElement) AddElement(element string)
func (*NodeElement) GetElement ¶
func (n *NodeElement) GetElement(element string) *NodeElement
type NodeTree ¶
type NodeTree struct {
Elements map[string]*NodeElement
}
New command handler
func (*NodeTree) AddCommand ¶
func (t *NodeTree) AddCommand(command *CommandSignature)
func (*NodeTree) GetElement ¶
func (t *NodeTree) GetElement(element string) *NodeElement
type NodeWorker ¶
NodeWorker contains workers of command
func (*NodeWorker) CheckMiddlewares ¶
func (w *NodeWorker) CheckMiddlewares(ctx *Context) bool
type PlaylistVideo ¶
type PlaylistVideo struct {
Id string `json:"id"`
}
PlaylistVideo contains playlist ID
type PollType ¶
type PollType struct { // Fields array of field names Fields []string // Votes map of votes Key: UserID Value: FieldKey Votes map[string]int }
PollType contains poll's data
type RadioStation ¶
RadioStation contains info about radio station
type Session ¶
type Session struct { Queue *SongQueue Player RadioPlayer ChannelID string Volume float32 // contains filtered or unexported fields }
Session structure with radio player and voice connection
func (*Session) GetConnection ¶
func (sess *Session) GetConnection() *Connection
GetConnection returns vice connection struct
type SessionManager ¶
type SessionManager struct {
// contains filtered or unexported fields
}
SessionManager contains all sessions
func NewSessionManager ¶
func NewSessionManager() *SessionManager
NewSessionManager creates and returns new session manager
func (*SessionManager) Count ¶
func (manager *SessionManager) Count() int
Count returns count of voice sessions
func (*SessionManager) GetAll ¶
func (manager *SessionManager) GetAll() map[string]*Session
func (*SessionManager) GetByChannel ¶
func (manager *SessionManager) GetByChannel(channelID string) (*Session, bool)
GetByChannel returns session by channel ID
func (*SessionManager) GetByGuild ¶
func (manager *SessionManager) GetByGuild(guildID string) *Session
GetByGuild returns session by guild ID
func (*SessionManager) GetChannels ¶
func (manager *SessionManager) GetChannels() []string
func (*SessionManager) GetGuilds ¶
func (manager *SessionManager) GetGuilds() []string
func (*SessionManager) Join ¶
func (manager *SessionManager) Join(discord *discordgo.Session, guildID, channelID string, properties JoinProperties, volume float32) (*Session, error)
Join add bot to voice channel
type SongQueue ¶
type SongQueue struct { Running bool // contains filtered or unexported fields }
SongQueue struct contains songs array
type TranslateConfig ¶
type TranslateConfig struct {
APIKey string
}
TranslateConfig Yandex translate config struct
type Twitch ¶
type Twitch struct { Guilds map[string]*TwitchGuild DB *DBWorker Conf *Config Discord *discordgo.Session }
Twitch contains streams
func TwitchInit ¶
TwitchInit makes new instance of twitch api worker
func (*Twitch) AddStreamer ¶
AddStreamer adds new streamer to list
func (*Twitch) OAuthToken ¶
func (*Twitch) RemoveStreamer ¶
RemoveStreamer removes streamer from list
type TwitchConfig ¶
TwitchConfig contains twitch api configs
type TwitchGameData ¶
type TwitchGameData struct { ID string `json:"id"` Name string `json:"name"` ArtURL string `json:"box_art_url"` }
TwitchGameData Twitch API response struct
type TwitchGameResult ¶
type TwitchGameResult struct {
Data []TwitchGameData `json:"data"`
}
TwitchGameResult contains response of Twitch API for games
type TwitchGuild ¶
type TwitchGuild struct { ID string Streams map[string]*TwitchStream }
TwitchGuild contains streams from specified guild
type TwitchStream ¶
type TwitchStream struct { Login string UserID string Name string Guild string Channel string ProfileImageURL string IsOnline bool IsCustom bool CustomMessage string CustomImageURL string }
TwitchStream contains stream data
type TwitchStreamData ¶
type TwitchStreamData struct { ID string `json:"id"` UserID string `json:"user_id"` UserName string `json:"user_name"` GameID string `json:"game_id"` Type string `json:"type"` Title string `json:"title"` Viewers int `json:"viewer_count"` Language string `json:"language"` ThumbnailURL string `json:"thumbnail_url"` }
TwitchStreamData Twitch API response struct
type TwitchStreamResult ¶
type TwitchStreamResult struct {
Data []TwitchStreamData `json:"data"`
}
TwitchStreamResult contains response of Twitch API for streams
type TwitchUserData ¶
type TwitchUserData struct { ID string `json:"id"` Login string `json:"login"` Name string `json:"display_name"` Type string `json:"type"` BroadcasterType string `json:"broadcaster_type"` Description string `json:"description"` ProfileImgURL string `json:"profile_image_url"` OfflineImgURL string `json:"offline_image_url"` Views int `json:"view_count"` }
TwitchUserData Twitch API response struct
type TwitchUserResult ¶
type TwitchUserResult struct {
Data []TwitchUserData `json:"data"`
}
TwitchUserResult contains response of Twitch API for users
type UserRoles ¶
UserRoles struct with array of user roles in guild
func (*UserRoles) ExistsName ¶
ExistsName checks if user role nema exists on user
type VideoResult ¶
VideoResult contains information about video
type WeatherConfig ¶
WeatherConfig Weather config struct
type YTSearchContent ¶
type YTSearchContent struct { Id string `json:"id"` Title string `json:"title"` Description string `json:"description"` ChannelTitle string `json:"channel_title"` Duration string `json:"duration"` }
YTSearchContent contains Youtube search result
type Youtube ¶
type Youtube struct {
Conf *Config
}
Youtube contains pointer to bot configuration struct
func (Youtube) Playlist ¶
func (youtube Youtube) Playlist(input string) (*[]PlaylistVideo, error)
Playlist returns Playlist