added source command
This commit is contained in:
@@ -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)
|
||||||
|
@@ -29,4 +29,9 @@ func roll(author string) string{
|
|||||||
max := 100
|
max := 100
|
||||||
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"
|
||||||
}
|
}
|
Reference in New Issue
Block a user