mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-01-18 18:46: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"
|
tb "gopkg.in/tucnak/telebot.v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
func Sponge(m *tb.Message) {
|
func spongify(inputMessage string) string {
|
||||||
message := ""
|
spongifiedMessage := ""
|
||||||
for i, char := range shared.History.LastMessage(m.Chat.ID) {
|
for i, char := range inputMessage {
|
||||||
if i%2 == 0 {
|
if i%2 == 0 {
|
||||||
message += strings.ToLower(string(char))
|
spongifiedMessage += strings.ToLower(string(char))
|
||||||
} else {
|
} else {
|
||||||
message += strings.ToUpper(string(char))
|
spongifiedMessage += strings.ToUpper(string(char))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
shared.Bot.Send(m.Chat, message)
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user