Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &commands.YAGCommand{ CmdCategory: commands.CategoryFun, Name: "Inspire", Aliases: []string{"insp"}, Description: "Shows 'inspirational' quotes from inspirobot.me", RunInDM: false, DefaultEnabled: true, SlashCommandEnabled: true, Cooldown: 3, Arguments: []*dcmd.ArgDef{ {Name: "Season", Type: dcmd.String, Default: ""}, }, ArgSwitches: []*dcmd.ArgDef{ {Name: "mindfulness", Help: "Generates Mindful Quotes!"}, }, RunFunc: func(data *dcmd.Data) (interface{}, error) { available := map[string]bool{"xmas": true} inspireArray := []string{} var paginatedView bool season := strings.ToLower(data.Args[0].Str()) if len(season) > 0 && !available[season] { return "Available seasons: `xmas`", nil } paginatedView = false if data.Switches["mindfulness"].Value != nil && data.Switches["mindfulness"].Value.(bool) { paginatedView = true } if paginatedView { result, err := inspireFromAPI(true, season) if err != nil { return nil, err } inspireArray = arrayMaker(inspireArray, result) return paginatedmessages.NewPaginatedResponse( data.GuildData.GS.ID, data.ChannelID, 1, 15, func(p *paginatedmessages.PaginatedMessage, page int) (*discordgo.MessageEmbed, error) { if page-1 == len(inspireArray) { result, err := inspireFromAPI(true, season) if err != nil { return nil, err } inspireArray = arrayMaker(inspireArray, result) } return createInspireEmbed(inspireArray[page-1], true), nil }), nil } inspData, err := inspireFromAPI(false, season) if err != nil { return fmt.Sprintf("%s\nInspiroBot wonky... sad times :/", err), err } embed := createInspireEmbed(inspData, false) return embed, nil }, }
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.