This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot-2/otouto/plugins/commit.lua
topkecleon 43a6b53c90 otouto 3.13
good lord
2016-08-13 22:26:44 -04:00

27 lines
604 B
Lua

local commit = {}
local utilities = require('otouto.utilities')
local bindings = require('otouto.bindings')
local http = require('socket.http')
commit.command = 'commit'
commit.doc = 'Returns a commit message from whatthecommit.com.'
function commit:init(config)
commit.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('commit').table
end
function commit:action(msg)
bindings.request(
self,
'sendMessage',
{
chat_id = msg.chat.id,
text = '```\n' .. (http.request('http://whatthecommit.com/index.txt')) .. '\n```',
parse_mode = 'Markdown'
}
)
end
return commit