Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cat = &dgc.Command{ Name: "cat", Domain: "astral.fun.cat", Aliases: []string{"cat", "c"}, Description: "Sends a random cat image from TheCatApi.", Category: "Fun", Usage: "cat", Slash: true, SlashGuilds: []string{os.Getenv("DEV_GUILD")}, Handler: func(ctx *dgc.Ctx) { cat, err := catapi.NewTheCatAPI("f7a9a450-2853-4c77-8b61-4a5431f110ac") if err != nil { utils.ErrorHandler(err) } images, err := cat.GetRandomPublicImage() if err != nil { utils.ErrorHandler(err) } randomImage := images[0] ctx.ReplyEmbed(utils.GenerateEmbed(*ctx, discordgo.MessageEmbed{ Title: "Cat", Description: "Have a cat!", Image: &discordgo.MessageEmbedImage{ URL: randomImage.URL, }, Color: 0x00ff00, })) }, }
View Source
var Dog = &dgc.Command{ Name: "dog", Domain: "astral.fun.dog", Aliases: []string{"dog"}, Description: "Sends a random dog image from TheDogApi.", Category: "Fun", Usage: "dog", Slash: true, Handler: func(ctx *dgc.Ctx) { dog, err := dogapi.RandomImage() if err != nil { utils.ErrorHandler(err) } ctx.ReplyEmbed(utils.GenerateEmbed(*ctx, discordgo.MessageEmbed{ Title: "Dog", Description: "Have a dog!", Image: &discordgo.MessageEmbedImage{ URL: dog, }, Color: 0x00ff00, })) }, }
View Source
var Eightball = &dgc.Command{ Name: "8ball", Domain: "astral.bot.eightball", Aliases: []string{"8ball", "8b", "eightball"}, Description: "Ask the magic 8ball a question.", Category: "Fun", Usage: "8ball [question]", Slash: true, SlashGuilds: []string{os.Getenv("DEV_GUILD")}, Handler: func(ctx *dgc.Ctx) { answers := []string{ "It is certain", "It is decidedly so", "Without a doubt", "Yes definitely", "You may rely on it", "As I see it, yes", "Most likely", "Outlook good", "Yes", "Signs point to yes", "Reply hazy try again", "Ask again later", "Better not tell you now", "Cannot predict now", "Concentrate and ask again", "Don't count on it", "My reply is no", "My sources say no", "Outlook not so good", "Very doubtful", } rand.Seed(time.Now().Unix()) amount := ctx.Arguments.Amount() if amount < 2 { ctx.ReplyEmbed(utils.GenerateEmbed(*ctx, discordgo.MessageEmbed{ Title: "Not Enough Arguments", Description: "You must provide a question to ask the magic 8ball.", Color: 0xff0000, })) return } question := ctx.Arguments.Raw() answer := answers[rand.Intn(len(answers))] ctx.ReplyEmbed(utils.GenerateEmbed(*ctx, discordgo.MessageEmbed{ Title: "Magic Eightball :8ball:", Fields: []*discordgo.MessageEmbedField{ { Name: "Question", Value: question, }, { Name: "Answer", Value: answer, }, }, Color: 0x00ff00, })) }, }
View Source
var Meme = &dgc.Command{ Name: "meme", Domain: "astral.bot.meme", Aliases: []string{"meme", "randommeme"}, Description: "Get a random meme.", Category: "Fun", Usage: "meme", Slash: true, SlashGuilds: []string{os.Getenv("DEV_GUILD")}, Handler: func(ctx *dgc.Ctx) { r, err := http.Get("https://meme-api.astralapp.io/gimme") if err != nil { utils.ErrorHandler(err) } defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) if err != nil { utils.ErrorHandler(err) } var meme MemeType err = json.Unmarshal(body, &meme) if err != nil { utils.ErrorHandler(err) } ctx.ReplyEmbed(utils.GenerateEmbed(*ctx, discordgo.MessageEmbed{ Title: "Meme", Description: "Have a meme!", Image: &discordgo.MessageEmbedImage{ URL: meme.URL, }, Color: 0x00ff00, })) }, }
View Source
var Rat = &dgc.Command{ Name: "rat", Domain: "astral.bot.rat", Aliases: []string{"rat", "randomrat"}, Description: "Get a random rat.", Category: "Fun", Usage: "rat", Slash: true, SlashGuilds: []string{os.Getenv("DEV_GUILD")}, Handler: func(ctx *dgc.Ctx) { r, err := http.Get("https://meme-api.astralapp.io/gimme/rats") if err != nil { utils.ErrorHandler(err) } defer r.Body.Close() body, err := ioutil.ReadAll(r.Body) if err != nil { utils.ErrorHandler(err) } var rat MemeType err = json.Unmarshal(body, &rat) if err != nil { utils.ErrorHandler(err) } ctx.ReplyEmbed(utils.GenerateEmbed(*ctx, discordgo.MessageEmbed{ Title: "Rat", Description: "Have a rat!", Image: &discordgo.MessageEmbedImage{ URL: rat.URL, }, })) }, }
Functions ¶
This section is empty.
Types ¶
Click to show internal directories.
Click to hide internal directories.