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

23 lines
599 B
Lua
Raw Normal View History

local commit = {}
2015-07-03 00:15:52 +02:00
2016-06-07 06:31:34 +02:00
local utilities = require('otouto.utilities')
2016-08-14 04:26:44 +02:00
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)
2016-08-14 04:46:18 +02:00
commit.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('commit').table
end
2015-07-03 00:15:52 +02:00
function commit:action(msg)
bindings.sendMessage{
chat_id = msg.chat.id,
text = '```\n' .. (http.request('http://whatthecommit.com/index.txt')) .. '\n```',
parse_mode = 'Markdown'
}
end
return commit