mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-01-18 10:36:44 +01:00
Merge pull request 'spongify_answer' (#19) from spongify_answer into master
Reviewed-on: https://git.klmp200.net/ALFRED/ALFRED/pulls/19
This commit is contained in:
commit
7b26cc3640
@ -15,15 +15,25 @@ import (
|
||||
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 := ""
|
||||
for i, char := range shared.History.LastMessage(m.Chat.ID) {
|
||||
if i%2 == 0 {
|
||||
message += strings.ToLower(string(char))
|
||||
if m.IsReply() {
|
||||
message = spongify(m.ReplyTo.Text)
|
||||
} else {
|
||||
message += strings.ToUpper(string(char))
|
||||
}
|
||||
message = spongify(shared.History.LastMessage(m.Chat.ID))
|
||||
}
|
||||
shared.Bot.Send(m.Chat, message)
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user