Documentation
¶
Index ¶
- Variables
- func AddAdminCommand(details *Request, s *discordgo.Session, allVerbs *[]Verb) discordgo.MessageSend
- func AddGif(verbName string, tags []string, g Gif, allVerbs *[]Verb) bool
- func AddGifCommand(details *Request, s *discordgo.Session, allVerbs *[]Verb) discordgo.MessageSend
- func AddSynonym(verbName string, baseName string, allVerbs *[]Verb) bool
- func AddSynonymCommand(details *Request, s *discordgo.Session, allVerbs *[]Verb) discordgo.MessageSend
- func AutoConfig()
- func ChooseCommand(details *Request, s *discordgo.Session, _ *[]Verb) discordgo.MessageSend
- func Contains(slice []string, s string) bool
- func DefaultKillFunction(r Response)
- func Eightball(details *Request, s *discordgo.Session, _ *[]Verb) discordgo.MessageSend
- func FCommand(details *Request, s *discordgo.Session, _ *[]Verb) discordgo.MessageSend
- func GetMentionNames(m *discordgo.Message, s *discordgo.Session) string
- func GetName(u *discordgo.User, guildID string, s *discordgo.Session) string
- func HelpCommand(details *Request, s *discordgo.Session, _ *[]Verb) discordgo.MessageSend
- func IfMatchHotStrings(arr []string, check string) bool
- func ListVerbs(_ *Request, _ *discordgo.Session, allVerbs *[]Verb) discordgo.MessageSend
- func Load(out *[]Verb)
- func ParseRequest(r *Request, s *discordgo.Session, allVerbs *[]Verb) discordgo.MessageSend
- func ReadViper()
- func RemoveGif(verbName string, url string, allVerbs *[]Verb) bool
- func RemoveGifCommand(details *Request, s *discordgo.Session, allVerbs *[]Verb) discordgo.MessageSend
- func Store(toStore []Verb) string
- func VerbCommand(myRequest *Request, s *discordgo.Session, allVerbs *[]Verb) discordgo.MessageSend
- type CheckFunction
- type Command
- type CommandFunction
- type Gif
- type KillFunction
- type Request
- type Response
- type ResponseFunction
- type Verb
Constants ¶
This section is empty.
Variables ¶
var ( AllCommands []Command = []Command{ { Name: "Verb", Description: "Posts a GIF based on the arguments the user gives", Template: "+<verbname> @<user> [-t <tags>]", HotStrings: []string{""}, Function: VerbCommand, Admin: false, Priority: 0, }, { Name: "List Verbs", Description: "Lists all verbs", Template: "+verbs", HotStrings: []string{"verbs"}, Function: ListVerbs, Admin: false, Priority: 0, }, { Name: "Eightball", Description: "Ask Shleepbot your most pressing questions...", Template: "+eightball Should I eat some ice cream?", HotStrings: []string{"eightball"}, Function: Eightball, Admin: false, Priority: 0, }, { Name: "F", Description: "Pay your respects for something/someone", Template: "+f Josh", HotStrings: []string{"f"}, Function: FCommand, Admin: false, Priority: 0, }, { Name: "Choose", Description: "Choose between a number of options!", Template: "+choose <option 1> | <option 2> | <option 3>", HotStrings: []string{"choose"}, Function: ChooseCommand, Admin: false, Priority: 0, }, { Name: "Add Gif", Description: "Adds a gif, and creates a verb if needed.", Template: "+add <verb> <url> [-t <tags>]", HotStrings: []string{"add"}, Function: AddGifCommand, Admin: true, Priority: 0, }, { Name: "Remove Gif", Description: "Removes a gif from a given verb.", Template: "+remove <verb> <url>", HotStrings: []string{"remove"}, Function: RemoveGifCommand, Admin: true, Priority: 0, }, { Name: "AddAdmin", Description: "Adds a given discord ID or mention as an admin", Template: "+addAdmin @<user>", HotStrings: []string{"addAdmin", "aadd", "adminAdd"}, Function: AddAdminCommand, Admin: true, Priority: 0, }, { Name: "Add Synonym", Description: "Adds a verb as a synonym for another", Template: "+synonym <new verb> <base verb>", HotStrings: []string{"synonym", "sadd", "synonymadd"}, Function: AddSynonymCommand, Admin: true, Priority: 0, }, } )
Functions ¶
func AddAdminCommand ¶
func AddGif ¶
AddGif will add a given gif to goshleep's database. If the verb isn't found, creates a new one.
func AddGifCommand ¶
AddGifCommand is an admin command that allows admins to add a gif, and creates a verb if it does not exist.
func AddSynonymCommand ¶
func ChooseCommand ¶
Chooses between a number of options
func DefaultKillFunction ¶
func DefaultKillFunction(r Response)
DefaultKillFunction is a minimalist kill function that simply flips alive to off.
func GetMentionNames ¶
GetMentionNames takes a message and a session, and returns a list of user nicks mentioned within.
func HelpCommand ¶
func ParseRequest ¶
This is the function that actually runs a request, or command.
func RemoveGif ¶
AddGif will add a given gif to goshleep's database. If the verb isn't found, creates a new one.
func RemoveGifCommand ¶
func RemoveGifCommand(details *Request, s *discordgo.Session, allVerbs *[]Verb) discordgo.MessageSend
RemoveGifCommand is an admin command that allows admins to remove a gif.
func VerbCommand ¶
VerbCommand takes in the follow expected string template: +<verb> [recipient] [-t tags] and returns a discord message, including a gif reaction of the inputted verb, assuming one exists.
Types ¶
type CheckFunction ¶
type CommandFunction ¶
type KillFunction ¶
type KillFunction func(r Response)
KillFunction is a function type used to kill Responses
type Request ¶
type Request struct {
Content string
SplitContent []string
Type Command
Resp *Response
// contains filtered or unexported fields
}
func ConstructRequest ¶
type Response ¶
type Response struct {
// Users IDS that can respond
UserList []string
// Function to run the response through
Run ResponseFunction
// Is this response still alive?
Alive bool
// Verify if the given message satisfies requirements
Check CheckFunction
// When was this response created?
Created time.Time
Kill KillFunction
// contains filtered or unexported fields
}
Response is a struct that lets goshleep ask a user questions and get respsonses.