mods: Make memegen work with replies

This commit is contained in:
Hamcha 2016-04-10 14:48:28 +02:00
parent 54dcccb892
commit ddc1ad0052

View file

@ -36,6 +36,12 @@ func initmeme() {
} }
func memegen(broker *tg.Broker, update tg.APIMessage) { func memegen(broker *tg.Broker, update tg.APIMessage) {
// Make replies work
if update.ReplyTo != nil && update.Text != nil && update.ReplyTo.Photo != nil {
update.Photo = update.ReplyTo.Photo
update.Caption = update.Text
}
if update.Photo != nil && update.Caption != nil { if update.Photo != nil && update.Caption != nil {
caption := *(update.Caption) caption := *(update.Caption)
if strings.HasPrefix(caption, "/meme ") && len(caption) > 6 { if strings.HasPrefix(caption, "/meme ") && len(caption) > 6 {