9f760114bd
All help messages and many other things moved from markdown to html. Eventually, I'd like only things made from user input to use markdown. cats.lua, rmspic.lua, and dilbert.lua moved to sendPhoto with URL. xkcd.lua and apod.lua not moved to retain formatting. Probably a lot of other stuff that I forget about. I should commit more often.
24 lines
645 B
Lua
24 lines
645 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)
|
|
local output = http.request('http://whatthecommit.com/index.txt') or 'Minor text fixes'
|
|
bindings.sendMessage{
|
|
chat_id = msg.chat.id,
|
|
text = '```\n' .. output .. '\n```',
|
|
parse_mode = 'Markdown'
|
|
}
|
|
end
|
|
|
|
return commit
|