add reply-to input support to shout.lua
This commit is contained in:
parent
b7d2fe7f82
commit
4848c9875b
@ -5,7 +5,7 @@ local utilities = require('utilities')
|
|||||||
shout.command = 'shout <text>'
|
shout.command = 'shout <text>'
|
||||||
shout.doc = [[```
|
shout.doc = [[```
|
||||||
/shout <text>
|
/shout <text>
|
||||||
Shouts something.
|
Shouts something. Input may be the replied-to message.
|
||||||
```]]
|
```]]
|
||||||
|
|
||||||
function shout:init()
|
function shout:init()
|
||||||
@ -15,11 +15,14 @@ end
|
|||||||
function shout:action(msg)
|
function shout:action(msg)
|
||||||
|
|
||||||
local input = utilities.input(msg.text)
|
local input = utilities.input(msg.text)
|
||||||
|
|
||||||
if not input then
|
if not input then
|
||||||
|
if msg.reply_to_message and #msg.reply_to_message.text > 0 then
|
||||||
|
input = msg.reply_to_message.text
|
||||||
|
else
|
||||||
utilities.send_message(self, msg.chat.id, shout.doc, true, msg.message_id, true)
|
utilities.send_message(self, msg.chat.id, shout.doc, true, msg.message_id, true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
end
|
||||||
input = utilities.trim(input)
|
input = utilities.trim(input)
|
||||||
|
|
||||||
if input:len() > 20 then
|
if input:len() > 20 then
|
||||||
|
Reference in New Issue
Block a user