26c1299374
help.lua has been rewritten to support "/help command". New variable "command" has been added to plugins for the syntax (w/out slash) to be displayed in main help message. "doc" will be displayed upon "/help command". Output of >12 plugins has been reformated to utilize markup. There is a fairly standard style throughout plugins. get_word() in utilities.lua now has defaults for nil arguments.
51 lines
924 B
Lua
51 lines
924 B
Lua
local command = 'shout <text>'
|
|
local doc = [[```
|
|
/shout <text>
|
|
Shouts something.
|
|
```]]
|
|
|
|
local triggers = {
|
|
'^/shout[@'..bot.username..']*'
|
|
}
|
|
|
|
local action = function(msg)
|
|
|
|
local input = msg.text:input()
|
|
|
|
if not input then
|
|
sendMessage(msg.chat.id, doc, true, msg.message_id, true)
|
|
return
|
|
end
|
|
input = input:trim()
|
|
|
|
if input:len() > 20 then
|
|
input = input:sub(1,20)
|
|
end
|
|
|
|
input = input:upper()
|
|
local output = ''
|
|
local inc = 0
|
|
for match in input:gmatch('.') do
|
|
output = output .. match .. ' '
|
|
end
|
|
output = output .. '\n'
|
|
for match in input:sub(2):gmatch('.') do
|
|
local spacing = ''
|
|
for i = 1, inc do
|
|
spacing = spacing .. ' '
|
|
end
|
|
inc = inc + 1
|
|
output = output .. match .. ' ' .. spacing .. match .. '\n'
|
|
end
|
|
output = '```\n' .. output:trim() .. '\n```'
|
|
sendMessage(msg.chat.id, output, true, false, true)
|
|
|
|
end
|
|
|
|
return {
|
|
action = action,
|
|
triggers = triggers,
|
|
doc = doc,
|
|
command = command
|
|
}
|