mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-01-18 10:36:44 +01:00
Add sponge
This commit is contained in:
parent
3dac9c01aa
commit
903e0daad1
16
alfred.go
16
alfred.go
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user