combined shrug and lenny

added flip, homo, shot

added reply arguments to 8ball, slap, whoami
aliased "/who" to whoami
This commit is contained in:
dupie 2015-07-10 20:46:51 -04:00
parent 8c9a5ae7ba
commit 566db41184
7 changed files with 54 additions and 44 deletions

View File

@ -26,13 +26,12 @@
"help.lua",
"hex.lua",
"imdb.lua",
"lenny.lua",
"personality.lua",
"pokedex.lua",
"pun.lua",
"reaction.lua",
"reddit.lua",
"remind.lua",
"shrug.lua",
"slap.lua",
"time.lua",
"urbandictionary.lua",

View File

@ -41,6 +41,10 @@ function PLUGIN.action(msg)
math.randomseed(os.time())
if msg.reply_to_message then
msg = msg.reply_to_message
end
if string.match(string.lower(msg.text), 'y/n') then
message = PLUGIN.yesno[math.random(#PLUGIN.yesno)]
else

View File

@ -1,17 +0,0 @@
local PLUGIN = {}
PLUGIN.triggers = {
'/lenny'
}
function PLUGIN.action(msg)
if msg.reply_to_message then
msg = msg.reply_to_message
end
send_msg(msg, '( ͡° ͜ʖ ͡°)')
end
return PLUGIN

27
plugins/reaction.lua Normal file
View File

@ -0,0 +1,27 @@
local PLUGIN = {}
PLUGIN.triggers = {
['¯\\_(ツ)_/¯'] = '/shrug$',
['( ͡° ͜ʖ ͡°)'] = '/lenny$',
['(╯°□°)╯︵ ┻━┻'] = '/flip$',
[' o'] = '/homo$',
['🔫'] = '/shot$'
}
function PLUGIN.action(msg)
local message = string.lower(msg.text)
if msg.reply_to_message then
msg = msg.reply_to_message
end
for k,v in pairs(PLUGIN.triggers) do
if string.match(message, v) then
return send_msg(msg, k)
end
end
end
return PLUGIN

View File

@ -1,17 +0,0 @@
local PLUGIN = {}
PLUGIN.triggers = {
'/shrug'
}
function PLUGIN.action(msg)
if msg.reply_to_message then
msg = msg.reply_to_message
end
send_msg(msg, '¯\\_(ツ)_/¯')
end
return PLUGIN

View File

@ -100,6 +100,7 @@ function PLUGIN.action(msg)
math.randomseed(os.time())
local slapper
local victim = get_input(msg.text)
if victim then
slapper = msg.from.first_name
@ -108,6 +109,14 @@ function PLUGIN.action(msg)
slapper = bot.first_name
end
if msg.reply_to_message then
victim = msg.reply_to_message.from.first_name
slapper = msg.from.first_name
if slapper == victim then
slapper = bot.first_name
end
end
local message = PLUGIN.getSlap(slapper, victim)
send_message(msg.chat.id, latcyr(message))

View File

@ -1,17 +1,28 @@
local PLUGIN = {}
PLUGIN.doc = [[
/whoami
Get the user ID for yourself and the group.
/who
Get the user ID for yourself and the group. Use it in a reply to get info for the sender of the original message.
]]
PLUGIN.triggers = {
'^/whoami',
'^/ping',
'^/who$'
}
function PLUGIN.action(msg)
if msg.from.id == msg.chat.id then
to_name = '@' .. bot.username .. ' (' .. bot.id .. ')'
else
to_name = string.gsub(msg.chat.title, '_', ' ') .. ' (' .. string.gsub(msg.chat.id, '-', '') .. ')'
end
if msg.reply_to_message then
msg = msg.reply_to_message
end
local from_name = msg.from.first_name
if msg.from.last_name then
from_name = from_name .. ' ' .. msg.from.last_name
@ -21,12 +32,6 @@ function PLUGIN.action(msg)
end
from_name = from_name .. ' (' .. msg.from.id .. ')'
if msg.from.id == msg.chat.id then
to_name = '@' .. bot.username .. ' (' .. bot.id .. ')'
else
to_name = string.gsub(msg.chat.title, '_', ' ') .. ' (' .. string.gsub(msg.chat.id, '-', '') .. ')'
end
local message = 'You are ' .. from_name .. ' and you are messaging ' .. to_name .. '.'
send_msg(msg, message)