From 9e33d58a14d7260fb0154d4d4e8d059826e3c4f6 Mon Sep 17 00:00:00 2001 From: Dustin Pianalto Date: Fri, 3 Apr 2020 13:34:39 -0800 Subject: [PATCH] add git command --- djpianalto.com/goff/exts/init.go | 1 + djpianalto.com/goff/exts/utils.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/djpianalto.com/goff/exts/init.go b/djpianalto.com/goff/exts/init.go index 2032cab..e72affe 100644 --- a/djpianalto.com/goff/exts/init.go +++ b/djpianalto.com/goff/exts/init.go @@ -14,4 +14,5 @@ func AddCommandHandlers(h *anpan.CommandHandler) { h.AddCommand("ping", "Check the bot's ping", false, false, 0, anpan.CommandTypeEverywhere, pingCommand) h.AddCommand("say", "Repeat a message", false, false, 0, anpan.CommandTypeEverywhere, sayCommand) h.AddCommand("user", "Show info about a user", false, false, 0, anpan.CommandTypeEverywhere, userCommand) + h.AddCommand("git", "Show my github link", false, false, 0, anpan.CommandTypeEverywhere, gitCommand) } diff --git a/djpianalto.com/goff/exts/utils.go b/djpianalto.com/goff/exts/utils.go index 1639714..0a865ac 100644 --- a/djpianalto.com/goff/exts/utils.go +++ b/djpianalto.com/goff/exts/utils.go @@ -19,6 +19,16 @@ func pingCommand(ctx anpan.Context, _ []string) error { return err } +func gitCommand(ctx anpan.Context, _ []string) error { + embed := &discordgo.MessageEmbed{ + Title: "Hi there, My code is on Github", + Color: 0, + URL: "https://github.com/dustinpianalto/Goff", + } + _, err := ctx.Session.ChannelMessageSendEmbed(ctx.Channel.ID, embed) + return err +} + func sayCommand(ctx anpan.Context, args []string) error { resp := strings.Join(args, " ") resp = strings.ReplaceAll(resp, "@everyone", "@\ufff0everyone")