mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-01-18 18:46:44 +01:00
39 lines
759 B
Go
39 lines
759 B
Go
/*
|
|
* @Author: Bartuccio Antoine
|
|
* @Date: 2018-07-24 11:52:11
|
|
* @Last Modified by: Bartuccio Antoine
|
|
* @Last Modified time: 2019-01-04 10:40:38
|
|
*/
|
|
|
|
package commands
|
|
|
|
import (
|
|
"strings"
|
|
|
|
"git.klmp200.net/ALFRED/ALFRED/shared"
|
|
|
|
tb "gopkg.in/tucnak/telebot.v2"
|
|
)
|
|
|
|
func Spongify(input_message string) string {
|
|
spongified_message := ""
|
|
for i, char := range input_message {
|
|
if i%2 == 0 {
|
|
spongified_message += strings.ToLower(string(char))
|
|
} else {
|
|
spongified_message += strings.ToUpper(string(char))
|
|
}
|
|
}
|
|
return spongified_message
|
|
}
|
|
|
|
func Sponge(m *tb.Message) {
|
|
message := ""
|
|
if m.IsReply() {
|
|
message = Spongify(m.ReplyTo.Text)
|
|
} else {
|
|
message = Spongify(shared.History.LastMessage(m.Chat.ID))
|
|
}
|
|
shared.Bot.Send(m.Chat, message)
|
|
}
|