add git command

pull/1/head
DustyP 6 years ago
parent e190aded25
commit 9e33d58a14

@ -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)
}

@ -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")

Loading…
Cancel
Save