Documentation ¶
Index ¶
Constants ¶
const AuthClearPath string = "data/authorizedToClear.json"
AuthClearPath is the path to the json that stores the authorized roles that can run `clear <username>`
const BannedWordsPath string = "data/bannedWords.json"
BannedWordsPath is the path to the banned words json file
const ChatPermissionRole string = "data/ruleRole.json"
ChatPermissionRole is the path to the banned words json file
const CommandDelay = 90
CommandDelay is the time (in seconds) to restrict command spam. Exported for unit tests.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agreement ¶
type Agreement struct { BaseRole string `json:"baseRole"` // ID of the role to give // contains filtered or unexported fields }
Agreement contains the data needed to save and execute the base role
func NewAgreement ¶
NewAgreement creates the struct to use the methods in rules.go
func (*Agreement) LoadAgreementRole ¶
LoadAgreementRole loads the saved json into the struct of banned words
type AkSession ¶
type AkSession interface { Channel(channelID string) (st *dg.Channel, err error) GuildMemberRoleAdd(guildID, userID, roleID string) (err error) ChannelMessages(channelID string, limit int, beforeID, afterID, aroundID string) (st []*dg.Message, err error) ChannelMessagesBulkDelete(channelID string, messages []string) (err error) GuildMembers(guildID string, after string, limit int) (st []*dg.Member, err error) }
AkSession allows for tests to mock the discordgo session.Channel() method call
type Blacklist ¶
type Blacklist struct {
// contains filtered or unexported fields
}
Blacklist contains the data needed to execute the method functionality
func NewBlacklist ¶
NewBlacklist creates the needed structs for running the ban methods
func (*Blacklist) CheckBannedWords ¶
func (b *Blacklist) CheckBannedWords(msg *dg.MessageCreate) (bool, error)
CheckBannedWords checks a message for banned words if the channel is not marked NSFW
func (*Blacklist) LoadBannedWordList ¶
LoadBannedWordList loads the saved json into the struct of banned words
type Crypto ¶
type Crypto struct {
// contains filtered or unexported fields
}
Crypto holds data that is needed to pass around the crypto game functions.
type Eraser ¶
type Eraser interface { ClearHandler(request []string, msg *dg.MessageCreate) error LoadAuthList(file string) error }
Eraser is the interface for interacting with the clear package.
type GifRequest ¶
GifRequest contains the data to be passed when executing the Gif() method.
func NewGifRequest ¶
func NewGifRequest(url ...string) *GifRequest
NewGifRequest creates GifRequest struct for calling the Gif method URL is optional to pass in the case the bot maintainer wants to use a different gif websites. If more than one URL is passed in the only first will be used.
func (*GifRequest) Gif ¶
func (g *GifRequest) Gif(req []string, s *dg.Session, msg *dg.MessageCreate) (string, error)
Gif makes sure the length of the slice is greater that 1 (ie; a tag has been passed with the request) and then return a random gif from Giphy.
type MemeRequest ¶
type MemeRequest struct {
// contains filtered or unexported fields
}
MemeRequest contains the data to be passed when executing the Gif() method.
func NewMemeRequest ¶
func NewMemeRequest(url ...string) *MemeRequest
NewMemeRequest creates GifRequest struct for calling the Gif method URL is optional to pass in the case the bot maintainer wants to use a different gif websites. If more than one URL is passed in the only first will be used.
func (*MemeRequest) RequestMeme ¶
func (m *MemeRequest) RequestMeme(req []string, s *dg.Session, msg *dg.MessageCreate) (string, error)
RequestMeme receives the users request for a meme with the given parameters. If the resquest is malformed (ie, only one word after --meme) the function terminates and returns a message to the sure on how to use the meme generator.
type Record ¶
Record holds the users last gif request to avoid spamming.
func (*Record) CheckLastAsk ¶
func (r *Record) CheckLastAsk(msg *dg.MessageCreate) (string, bool)
CheckLastAsk checks the last time the user executed the specific command
type Rule34Request ¶
type Rule34Request struct {
// contains filtered or unexported fields
}
Rule34Request contains the data to be passed when executing the Rule34() method.
func NewRule34Request ¶
func NewRule34Request(url ...string) *Rule34Request
NewRule34Request creates Rule34Request struct for calling the Rule34 method URL is optional to pass in the case the bot maintainer wants to use a different gif websites. If more than one URL is passed in the only first will be used.
func (*Rule34Request) Rule34 ¶
func (rr *Rule34Request) Rule34(req []string, s AkSession, msg *dg.MessageCreate) (string, error)
Rule34 checks that the channel ID is marked as NSFW, makes sure the length of the slice is greater that 1 (ie; a tag has been passed with the request) and then retrieves the data.