2016-02-25 16:08:27 +01:00
|
|
|
|
-- Never change this plugin. It was not meant to be changed.
|
|
|
|
|
-- You may add reactions. You must never remove reactions.
|
|
|
|
|
-- You must never restructure. You must never disable this plugin.
|
|
|
|
|
-- ~ Drew, creator, a year later.
|
|
|
|
|
|
2016-04-11 06:04:47 +02:00
|
|
|
|
local reactions = {}
|
|
|
|
|
|
|
|
|
|
local bindings = require('bindings')
|
|
|
|
|
local utilities = require('utilities')
|
|
|
|
|
|
|
|
|
|
reactions.command = 'reactions'
|
|
|
|
|
reactions.doc = '`Returns a list of "reaction" emoticon commands.`'
|
|
|
|
|
|
|
|
|
|
local mapping = {
|
|
|
|
|
['shrug'] = '¯\\_(ツ)_/¯',
|
|
|
|
|
['lenny'] = '( ͡° ͜ʖ ͡°)',
|
|
|
|
|
['flip'] = '(╯°□°)╯︵ ┻━┻',
|
|
|
|
|
['homo'] = '┌(┌ ^o^)┐',
|
|
|
|
|
['look'] = 'ಠ_ಠ',
|
2016-05-13 22:09:40 +02:00
|
|
|
|
['shots?'] = 'SHOTS FIRED',
|
|
|
|
|
['facepalm'] = '(-‸ლ)'
|
2015-11-25 03:22:04 +01:00
|
|
|
|
}
|
|
|
|
|
|
2016-04-11 06:04:47 +02:00
|
|
|
|
local help
|
|
|
|
|
|
|
|
|
|
function reactions:init()
|
|
|
|
|
-- Generate a "help" message triggered by "/reactions".
|
2016-04-29 06:36:35 +02:00
|
|
|
|
help = 'Reactions:\n'
|
2016-04-11 06:04:47 +02:00
|
|
|
|
reactions.triggers = utilities.triggers(self.info.username):t('reactions').table
|
|
|
|
|
for trigger,reaction in pairs(mapping) do
|
2016-05-13 22:09:40 +02:00
|
|
|
|
help = help .. '• ' .. utilities.INVOCATION_PATTERN .. trigger:gsub('.%?', '') .. ': ' .. reaction .. '\n'
|
2016-04-14 05:48:20 +02:00
|
|
|
|
table.insert(reactions.triggers, utilities.INVOCATION_PATTERN..trigger)
|
2016-04-29 06:36:35 +02:00
|
|
|
|
table.insert(reactions.triggers, utilities.INVOCATION_PATTERN..trigger..'@'..self.info.username:lower())
|
2016-04-11 06:04:47 +02:00
|
|
|
|
end
|
2015-11-25 03:22:04 +01:00
|
|
|
|
end
|
|
|
|
|
|
2016-04-11 06:04:47 +02:00
|
|
|
|
function reactions:action(msg)
|
2016-04-29 06:36:35 +02:00
|
|
|
|
if string.match(msg.text_lower, utilities.INVOCATION_PATTERN..'reactions') then
|
2016-04-11 06:04:47 +02:00
|
|
|
|
bindings.sendMessage(self, msg.chat.id, help)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
for trigger,reaction in pairs(mapping) do
|
|
|
|
|
if string.match(msg.text_lower, utilities.INVOCATION_PATTERN..trigger) then
|
|
|
|
|
bindings.sendMessage(self, msg.chat.id, reaction)
|
2015-11-25 03:22:04 +01:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2016-04-11 06:04:47 +02:00
|
|
|
|
return reactions
|