mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-01-18 18:46:44 +01:00
7b4f2d3b25
Because this shity language can't deal with snake_case and the snake_case evangile is a traitor to it's cause.
40 lines
754 B
Go
40 lines
754 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(inputMessage string) string {
|
|
spongifiedMessage := ""
|
|
for i, char := range inputMessage {
|
|
if i%2 == 0 {
|
|
spongifiedMessage += strings.ToLower(string(char))
|
|
} else {
|
|
spongifiedMessage += strings.ToUpper(string(char))
|
|
}
|
|
}
|
|
return spongifiedMessage
|
|
}
|
|
|
|
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)
|
|
}
|
|
|