Add sponge
Some checks failed
the build failed

This commit is contained in:
Antoine Bartuccio 2018-07-24 02:34:55 +02:00
parent 3dac9c01aa
commit 903e0daad1
Signed by: klmp200
GPG Key ID: E7245548C53F904B

View File

@ -2,7 +2,7 @@
* @Author: Bartuccio Antoine
* @Date: 2018-07-23 15:24:22
* @Last Modified by: klmp200
* @Last Modified time: 2018-07-24 02:25:26
* @Last Modified time: 2018-07-24 02:33:57
*/
package main
@ -12,6 +12,7 @@ import (
"./shared"
tb "gopkg.in/tucnak/telebot.v2"
"log"
"strings"
"time"
)
@ -41,6 +42,19 @@ func main() {
shared.History.AddMessage(m.Chat.ID, m.Text)
})
b.Handle("/sponge", func(m *tb.Message) {
message := ""
for i, char := range shared.History.LastMessage(m.Chat.ID) {
if i%2 == 0 {
message += strings.ToLower(string(char))
} else {
message += strings.ToUpper(string(char))
}
}
b.Send(m.Chat, message)
})
log.Println("Starting bot")
b.Start()
}