mirror of
https://git.klmp200.net/ALFRED/ALFRED.git
synced 2025-04-11 10:14:41 +02:00
Calling the /sponge command as a reply will now spongify the quoted message
This commit is contained in:
parent
3d3133eaff
commit
9df38b5a88
1 changed files with 16 additions and 7 deletions
|
@ -15,15 +15,24 @@ import (
|
|||
tb "gopkg.in/tucnak/telebot.v2"
|
||||
)
|
||||
|
||||
func Sponge(m *tb.Message) {
|
||||
message := ""
|
||||
for i, char := range shared.History.LastMessage(m.Chat.ID) {
|
||||
func Spongify(input_message string) string {
|
||||
spongified_message := ""
|
||||
for i, char := range input_message {
|
||||
if i%2 == 0 {
|
||||
message += strings.ToLower(string(char))
|
||||
spongified_message += strings.ToLower(string(char))
|
||||
} else {
|
||||
message += strings.ToUpper(string(char))
|
||||
spongified_message += strings.ToUpper(string(char))
|
||||
}
|
||||
}
|
||||
shared.Bot.Send(m.Chat, message)
|
||||
|
||||
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)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue