added source command

This commit is contained in:
2020-06-10 01:15:05 -05:00
parent 12cfe02319
commit dd95bcf73e
2 changed files with 7 additions and 0 deletions

View File

@@ -79,6 +79,8 @@ func message_create (s *discordgo.Session, m *discordgo.MessageCreate) {
s.ChannelMessageSend(m.ChannelID, coinflip(m.Author.ID)) s.ChannelMessageSend(m.ChannelID, coinflip(m.Author.ID))
} else if message == "roll" { // roll a number } else if message == "roll" { // roll a number
s.ChannelMessageSend(m.ChannelID, roll(m.Author.ID)) s.ChannelMessageSend(m.ChannelID, roll(m.Author.ID))
} else if message == "source" { // print source code
s.ChannelMessageSend(m.ChannelID, source())
} else if len(message) > 0 { // as long as there is a message, try to find a picture } else if len(message) > 0 { // as long as there is a message, try to find a picture
// get url // get url
url := <-get_image(message) url := <-get_image(message)

View File

@@ -30,3 +30,8 @@ func roll(author string) string{
num := rand.Intn(max - min) + min num := rand.Intn(max - min) + min
return "<@" + author + "> rolls a number between 1 and 100. They roll **" + strconv.Itoa(num) + "**." return "<@" + author + "> rolls a number between 1 and 100. They roll **" + strconv.Itoa(num) + "**."
} }
// source code
func source() string {
return "BunnyBot is a Discord bot written in Go. You can view the source code here: https://git.dtam.pw/daniel/GoBunnyBot"
}