forked from git.klmp200.net/ALFRED
Add sponge
This commit is contained in:
parent
3dac9c01aa
commit
903e0daad1
16
alfred.go
16
alfred.go
@ -2,7 +2,7 @@
|
|||||||
* @Author: Bartuccio Antoine
|
* @Author: Bartuccio Antoine
|
||||||
* @Date: 2018-07-23 15:24:22
|
* @Date: 2018-07-23 15:24:22
|
||||||
* @Last Modified by: klmp200
|
* @Last Modified by: klmp200
|
||||||
* @Last Modified time: 2018-07-24 02:25:26
|
* @Last Modified time: 2018-07-24 02:33:57
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package main
|
package main
|
||||||
@ -12,6 +12,7 @@ import (
|
|||||||
"./shared"
|
"./shared"
|
||||||
tb "gopkg.in/tucnak/telebot.v2"
|
tb "gopkg.in/tucnak/telebot.v2"
|
||||||
"log"
|
"log"
|
||||||
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -41,6 +42,19 @@ func main() {
|
|||||||
shared.History.AddMessage(m.Chat.ID, m.Text)
|
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")
|
log.Println("Starting bot")
|
||||||
b.Start()
|
b.Start()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user