mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-01-18 18:46:44 +01:00
Calling the /sponge command as a reply will now spongify the quoted message
This commit is contained in:
parent
3d3133eaff
commit
9df38b5a88
@ -15,15 +15,24 @@ import (
|
|||||||
tb "gopkg.in/tucnak/telebot.v2"
|
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) {
|
func Sponge(m *tb.Message) {
|
||||||
message := ""
|
message := ""
|
||||||
for i, char := range shared.History.LastMessage(m.Chat.ID) {
|
if m.IsReply() {
|
||||||
if i%2 == 0 {
|
message = Spongify(m.ReplyTo.Text)
|
||||||
message += strings.ToLower(string(char))
|
|
||||||
} else {
|
} else {
|
||||||
message += strings.ToUpper(string(char))
|
message = Spongify(shared.History.LastMessage(m.Chat.ID))
|
||||||
}
|
|
||||||
}
|
}
|
||||||
shared.Bot.Send(m.Chat, message)
|
shared.Bot.Send(m.Chat, message)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user