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/plugins/reactions.lua
topkecleon 725261fcf7 Version 3.8
Relicense to AGPLv3, with consent of contributors.
bindings.lua completely rewritten. Shift to multipart-post.
Updated readme.
New plugins: bing.lua, channel.lua.
Removed plugins: floodcontrol.lua, librefm.lua.
luarun.lua: Will now serialize returned tables. Aliased "/return" to "/lua return".
2016-05-29 13:08:39 -04:00

53 lines
1.6 KiB
Lua
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

-- 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.
-- Nevermind, Brayden changed it.
-- - Drew, just now.
local reactions = {}
local utilities = require('utilities')
reactions.command = 'reactions'
reactions.doc = '`Returns a list of "reaction" emoticon commands.`'
local mapping = {
['shrug'] = '¯\\_(ツ)_/¯',
['lenny'] = '( ͡° ͜ʖ ͡°)',
['flip'] = '(╯°□°)╯︵ ┻━┻',
['homo'] = ' o',
['look'] = 'ಠ_ಠ',
['shots?'] = 'SHOTS FIRED',
['facepalm'] = '(-‸ლ)'
}
local help
function reactions:init()
-- Generate a "help" message triggered by "/reactions".
help = 'Reactions:\n'
reactions.triggers = utilities.triggers(self.info.username):t('reactions').table
for trigger,reaction in pairs(mapping) do
help = help .. '' .. utilities.INVOCATION_PATTERN .. trigger:gsub('.%?', '') .. ': ' .. reaction .. '\n'
table.insert(reactions.triggers, utilities.INVOCATION_PATTERN..trigger)
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..'reactions') then
utilities.send_message(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
utilities.send_message(self, msg.chat.id, reaction)
return
end
end
end
return reactions