Let's get this rock rolling!
This commit is contained in:
@@ -1063,7 +1063,7 @@ function administration.init_command(self_)
|
||||
local input = utilities.input(msg.text) or msg.chat.id_str
|
||||
local output
|
||||
if self.database.administration.groups[input] then
|
||||
local chat_name = self.administration.groups[input].name
|
||||
local chat_name = self.database.administration.groups[input].name
|
||||
self.database.administration.groups[input] = nil
|
||||
for i,v in ipairs(self.database.administration.activity) do
|
||||
if v == input then
|
||||
|
@@ -29,7 +29,7 @@ function bandersnatch:action(msg)
|
||||
output = firstnames[math.random(#firstnames)] .. ' ' .. lastnames[math.random(#lastnames)]
|
||||
end
|
||||
|
||||
bindings.sendReply(self, msg, output)
|
||||
bindings.sendMessage(self, msg.chat.id, '_'..output..'_', true, nil, true)
|
||||
|
||||
end
|
||||
|
||||
|
@@ -22,7 +22,7 @@ function calc:action(msg)
|
||||
if msg.reply_to_message and msg.reply_to_message.text then
|
||||
input = msg.reply_to_message.text
|
||||
else
|
||||
bindings.sendMessage(msg.chat.id, calc.doc, true, msg.message_id, true)
|
||||
bindings.sendMessage(self, msg.chat.id, calc.doc, true, msg.message_id, true)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
@@ -17,6 +17,14 @@ function control:action(msg)
|
||||
if msg.date < os.time() - 1 then return end
|
||||
|
||||
if msg.text:match('^'..utilities.INVOCATION_PATTERN..'reload') then
|
||||
for pac, _ in pairs(package.loaded) do
|
||||
if pac:match('^plugins%.') then
|
||||
package.loaded[pac] = nil
|
||||
end
|
||||
package.loaded['bindings'] = nil
|
||||
package.loaded['utilities'] = nil
|
||||
package.loaded['config'] = nil
|
||||
end
|
||||
bot.init(self)
|
||||
bindings.sendReply(self, msg, 'Bot reloaded!')
|
||||
elseif msg.text:match('^'..utilities.INVOCATION_PATTERN..'halt') then
|
||||
|
@@ -52,7 +52,8 @@ function currency:action(msg)
|
||||
end
|
||||
|
||||
local output = amount .. ' ' .. from .. ' = ' .. result .. ' ' .. to .. '\n\n'
|
||||
output = output .. '`' .. os.date('!%F %T UTC') .. '\nSource: Google Finance`'
|
||||
output = output .. os.date('!%F %T UTC') .. '\nSource: Google Finance`'
|
||||
output = '```\n' .. output .. '\n```'
|
||||
|
||||
bindings.sendMessage(self, msg.chat.id, output, true, nil, true)
|
||||
|
||||
|
@@ -46,7 +46,7 @@ function imdb:action(msg)
|
||||
local output = '*' .. jdat.Title .. ' ('.. jdat.Year ..')*\n'
|
||||
output = output .. jdat.imdbRating ..'/10 | '.. jdat.Runtime ..' | '.. jdat.Genre ..'\n'
|
||||
output = output .. '_' .. jdat.Plot .. '_\n'
|
||||
output = output .. '[*Read more*](http://imdb.com/title/' .. jdat.imdbID .. ')'
|
||||
output = output .. '[Read more.](http://imdb.com/title/' .. jdat.imdbID .. ')'
|
||||
|
||||
bindings.sendMessage(self, msg.chat.id, output, true, nil, true)
|
||||
|
||||
|
@@ -19,7 +19,7 @@ function luarun:action(msg)
|
||||
return
|
||||
end
|
||||
|
||||
local output = loadstring('local bindings = require(\'bindings\'); local utilities = require(\'utilities\'); return function (instance, msg) '..input..' end')()(self, msg)
|
||||
local output = loadstring('local bindings = require(\'bindings\'); local utilities = require(\'utilities\'); return function (self, msg) '..input..' end')()(self, msg)
|
||||
if output == nil then
|
||||
output = 'Done!'
|
||||
elseif type(output) == 'table' then
|
||||
|
@@ -24,17 +24,17 @@ local help
|
||||
|
||||
function reactions:init()
|
||||
-- Generate a "help" message triggered by "/reactions".
|
||||
local help = 'Reactions:\n'
|
||||
help = 'Reactions:\n'
|
||||
reactions.triggers = utilities.triggers(self.info.username):t('reactions').table
|
||||
for trigger,reaction in pairs(mapping) do
|
||||
help = help .. '• ' .. trigger:gsub('.%?', '') .. ': ' .. reaction .. '\n'
|
||||
help = help .. '• ' .. utilities.INVOCATION_PATTERN..trigger .. trigger:gsub('.%?', '') .. ': ' .. reaction .. '\n'
|
||||
table.insert(reactions.triggers, utilities.INVOCATION_PATTERN..trigger)
|
||||
table.insert(reactions.triggers, utilities.INVOCATION_PATTERN..trigger..'@'..self.username:lower())
|
||||
table.insert(reactions.triggers, utilities.INVOCATION_PATTERN..trigger..'@'..self.info.username:lower())
|
||||
end
|
||||
end
|
||||
|
||||
function reactions:action(msg)
|
||||
if string.match(msg.text_lower, utilities.INVOCATION_PATTERN..'help') then
|
||||
if string.match(msg.text_lower, utilities.INVOCATION_PATTERN..'reactions') then
|
||||
bindings.sendMessage(self, msg.chat.id, help)
|
||||
return
|
||||
end
|
||||
|
@@ -17,7 +17,7 @@ end
|
||||
|
||||
function remind:action(msg)
|
||||
-- Ensure there are arguments. If not, send doc.
|
||||
local input = msg.text:input()
|
||||
local input = utilities.input(msg.text)
|
||||
if not input then
|
||||
bindings.sendMessage(self, msg.chat.id, remind.doc, true, msg.message_id, true)
|
||||
return
|
||||
@@ -36,7 +36,7 @@ function remind:action(msg)
|
||||
duration = 526000
|
||||
end
|
||||
-- Ensure there is a second arg.
|
||||
local message = input:input()
|
||||
local message = utilities.input(input)
|
||||
if not message then
|
||||
bindings.sendMessage(self, msg.chat.id, remind.doc, true, msg.message_id, true)
|
||||
return
|
||||
|
@@ -53,9 +53,10 @@ function time:action(msg)
|
||||
else
|
||||
utcoff = utilities.pretty_float(utcoff)
|
||||
end
|
||||
local output = '`' .. os.date('!%I:%M %p\n', timestamp) .. os.date('!%A, %B %d, %Y\n', timestamp) .. jdat.timeZoneName .. ' (UTC' .. utcoff .. ')``'
|
||||
local output = os.date('!%I:%M %p\n', timestamp) .. os.date('!%A, %B %d, %Y\n', timestamp) .. jdat.timeZoneName .. ' (UTC' .. utcoff .. ')'
|
||||
output = '```\n' .. output .. '\n```'
|
||||
|
||||
bindings.sendReply(self, msg, output)
|
||||
bindings.sendReply(self, msg, output, true)
|
||||
|
||||
end
|
||||
|
||||
|
@@ -45,7 +45,7 @@ function translate:action(msg)
|
||||
local output = jdat.text[1]
|
||||
output = '*Translation:*\n"' .. utilities.md_escape(output) .. '"'
|
||||
|
||||
bindings.sendReply(self, msg.reply_to_message or msg, output)
|
||||
bindings.sendReply(self, msg.reply_to_message or msg, output, true)
|
||||
|
||||
end
|
||||
|
||||
|
@@ -57,7 +57,7 @@ function weather:action(msg)
|
||||
local fahrenheit = string.format('%.2f', celsius * (9/5) + 32)
|
||||
local output = '`' .. celsius .. '°C | ' .. fahrenheit .. '°F, ' .. jdat.weather[1].description .. '.`'
|
||||
|
||||
bindings.sendReply(self, msg, output)
|
||||
bindings.sendReply(self, msg, output, true)
|
||||
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user