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
2016-08-13 22:46:18 -04:00

27 lines
664 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