- Passe "Stille" an

Portiere:
- Saved_text
- Spam
- Special
This commit is contained in:
Andreas Bielawski 2016-08-25 01:18:26 +02:00
parent cb4c0faf30
commit 05faa356cc
4 changed files with 201 additions and 10 deletions

View File

@ -0,0 +1,58 @@
local saved_text = {}
saved_text.triggers = {
"^/(deltext) (.+)$",
"^/(addtext) (.+)$",
"^/(listtext)$"
}
local text_hash = 'telegram:savedtext'
function saved_text:save_text(text)
print('Saving stille to redis set '..text_hash)
redis:sadd(text_hash, text)
return '<b>Gespeichert:</b> <i>'..text..'</i>'
end
function saved_text:delete_text(text)
print('Deleting text from redis set '..text_hash)
if redis:sismember(text_hash, text) == true then
redis:srem(text_hash, text)
return 'Text erfolgreich gelöscht!'
else
return 'Dieser Text existiert nicht.'
end
end
function saved_text:list_text()
print('Getting text from redis set '..text_hash)
local text_table = redis:smembers(text_hash)
local text = ""
for num,stille in pairs(text_table) do
text = text..num..") "..stille..'\n'
end
if not text or text == "" then
return 'Es wurden noch keine Texte gespeichert.\nSpeichere doch welche mit /addtext [Text]'
else
return text
end
end
function saved_text:action(msg, config, matches)
if not is_sudo(msg, config) then
return -- Silent Ignore
end
if matches[1] == "addtext" then
utilities.send_reply(msg, saved_text:save_text(matches[2]), 'HTML')
return
elseif matches[1] == "deltext" then
utilities.send_reply(msg, saved_text:delete_text(matches[2]), 'HTML')
return
elseif matches[1] == "listtext" then
utilities.send_reply(msg, saved_text:list_text())
return
end
end
return saved_text

12
miku/plugins/spam.lua Normal file
View File

@ -0,0 +1,12 @@
local spam = {}
function spam:init(config)
spam.triggers = utilities.triggers(self.info.username, config.cmd_pat):t('spam', true).table
end
function spam:action(msg, config)
local text = string.rep('SPAM ', 819)
utilities.send_reply(msg, text)
end
return spam

123
miku/plugins/special.lua Normal file
View File

@ -0,0 +1,123 @@
local special = {}
special.triggers = {
"[Rr][Ii][Cc][Hh] [Bb][Ii][Tt][Cc][Hh]",
"^/[Oo][Ll][Dd]$",
"^[Nn][Yy][Uu]$",
"^[Nn][Oo][Pp][Ee].[Aa][Vv][Ii]$",
"^[Nn][Ii][Ii][Ss][Aa][Nn]$",
"^[Nn][Ii][Ii](-)[Ss][Aa][Nn]$",
"^[Nn][Ii][Ss][Ss][Aa][Nn]$",
"^/[Nn][Ee][Oo][Rr][Aa][Mm][Ee]$",
"^/[Nn][Aa][Uu]$",
"^/[Ff][Tt][Tt]$",
"^/[Ff][Tt][Ff]$",
"^[Mm]ö[Pp]?$",
"^[Mm][Ee][Ee][Pp]$",
"^/[Bb][Aa][Rr][Uu][Ss][Aa][Mm][Ii][Kk][Oo][Ss][Uu]$",
"^/[Bb][Aa][Ll][Ss][Aa][Mm][Ii][Kk][Oo] [Ee][Ss][Ss][Ii][Gg]$",
"^[Bb][Aa][Kk][Aa] [Bb][Oo][Tt]$",
"^[Aa][Hh][Aa].[Pp][Nn][Gg]$",
"^~?[Pp][Oo][Ii]$",
"^/[Tt][Hh][Yy][Mm][Ee]$",
"^[Yy][Oo][Ll][Oo]$",
"^/[Kk][Aa][Pp][Pp][Aa]$",
"[Ii] [Ww][Ii][Ss][Hh] [Ss][Qq][Uu][Ii][Dd][Ss] [Ww][Ee][Rr][Ee] [Rr][Ee][Aa][Ll]",
"^/[Kk][Ii][Ll][Ll] (.*)",
"^[Ii][Nn][Ll][Oo][Vv][Ee]$",
"^[Pp][Ee]$",
"^[Vv][Aa]$",
"^[Mm][Uu]$",
"^/[Ii][Yy][Kk][Ww][Ii][Mm]$"
}
function special:action(msg, config, matches)
local msg_text = msg.text
local output
if msg_text:match("[Rr][Ii][Cc][Hh] [Bb][Ii][Tt][Cc][Hh]") then
output = 'Akamaru ist nicht reich!'
elseif msg_text:match("/[Oo][Ll][Dd]") then
output = 'Deine Mudda is old!'
elseif msg_text:match("[Nn][Yy][Uu]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/JSXH/nyu.jpg'), nil, msg.message_id)
return
elseif msg_text:match("[Nn][Oo][Pp][Ee].[Aa][Vv][Ii]") then
utilities.send_typing(msg.chat.id, 'upload_video')
utilities.send_video(msg.chat.id, download_to_file('https://dl.dropboxusercontent.com/u/32829149/nope.avi'), nil, msg.message_id)
return
elseif msg_text:match("[Nn][Ii][Ii][Ss][Aa][Nn]") or msg_text:match("[Nn][Ii][Ii](-)[Ss][Aa][Nn]") or msg_text:match("[Nn][Ii][Ss][Ss][Aa][Nn]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/XB2T/Nii-san.jpg'), nil, msg.message_id)
return
elseif msg_text:match("/[Nn][Ee][Oo][Rr][Aa][Mm][Ee]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/GM93/neorame.jpg'), nil, msg.message_id)
return
elseif msg_text:match("[Nn][Aa][Uu]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/V1QH/nau.jpg'), nil, msg.message_id)
return
elseif msg_text:match("[Ff][Tt][Tt]") then
output = [[(°°) FLIP THAT TABLE.
(°°) FLIP THIS TABLE.
(`0`)/ FLIP ALL THE TABLES
_ಠ Child. . .
_ಠ Put.
__ಠ The tables.
___ಠ Back.
(°-°)
(°°) NEVER]]
elseif msg_text:match("[Ff][Tt][Ff]") then
output = [[() FLIP THAT FATHER.
() FLIP THIS FATHER.
()/ FLIP ALL THE FATHERS
Child. . .
Put.
The Fathers.
Back.
()_ಠ
() NEVER]]
elseif msg_text:match("[Mm]ö[Pp]?") or msg_text:match("[Mm][Ee][Ee][Pp]") then
output = 'se'
elseif msg_text:match("[Bb][Aa][Rr][Uu][Ss][Aa][Mm][Ii][Kk][Oo][Ss][Uu]") or msg_text:match("[Bb][Aa][Ll][Ss][Aa][Mm][Ii][Kk][Oo] [Ee][Ss][Ss][Ii][Gg]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/0SEY/barusamikosu.jpg'), nil, msg.message_id)
return
elseif msg_text:match("[Bb][Aa][Kk][Aa] [Bb][Oo][Tt]") then
output = 'Gomen\'nasai '..msg.from.first_name..'-sempai 😣'
elseif msg_text:match("[Aa][Hh][Aa].[Pp][Nn][Gg]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/W97R/aha.png'), nil, msg.message_id)
return
elseif msg_text:match("[Pp][Oo][Ii]") then
utilities.send_document(msg.chat.id, download_to_file('https://dl.dropboxusercontent.com/u/32829149/poi.webp'), nil, msg.message_id)
return
elseif msg_text:match("/[Tt][Hh][Yy][Mm][Ee]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/N6NO/thyme.jpg'), nil, msg.message_id)
return
elseif msg_text:match("[Yy][Oo][Ll][Oo]") then
output = 'Hä YOLO?'
elseif msg_text:match("/[Kk][Aa][Pp][Pp][Aa]") then
output = [[
]]
elseif msg_text:match("[Ii] [Ww][Ii][Ss][Hh] [Ss][Qq][Uu][Ii][Dd][Ss] [Ww][Ee][Rr][Ee] [Rr][Ee][Aa][Ll]") then
utilities.send_photo(msg.chat.id, download_to_file('http://img.ponywave.de/di/N03B/squid.jpg'), 'They are', msg.message_id)
return
elseif msg_text:match("[Kk][Ii][Ll][Ll]") then
output = msg.first.first_name..' tötet '..matches[1]
elseif msg_text:match("[Pp][Ee]") then
output = 'nis'
elseif msg_text:match("[Vv][Aa]") then
output = 'gina'
elseif msg_text:match("[Mm][Uu]") then
output = 'schi'
elseif msg_text:match("/[Ii][Yy][Kk][Ww][Ii][Mm]") then
output = '(¬‿¬)'
end
utilities.send_reply(msg, output)
end
return special

View File

@ -10,17 +10,15 @@ stille.triggers = {
local stille_hash = 'telegram:stille' local stille_hash = 'telegram:stille'
function stille:save_stille(text) function stille:save_stille(text)
local stille = text:sub(11)
print('Saving stille to redis set '..stille_hash) print('Saving stille to redis set '..stille_hash)
redis:sadd(stille_hash, stille) redis:sadd(stille_hash, text)
return '<b>Gespeichert:</b> <i>'..stille..'</i>' return '<b>Gespeichert:</b> <i>'..text..'</i>'
end end
function stille:delete_stille(text) function stille:delete_stille(text)
local stille = text:sub(11)
print('Deleting stille from redis set '..stille_hash) print('Deleting stille from redis set '..stille_hash)
if redis:sismember(stille_hash, stille) == true then if redis:sismember(stille_hash, text) == true then
redis:srem(stille_hash, stille) redis:srem(stille_hash, text)
return 'Zitat erfolgreich gelöscht!' return 'Zitat erfolgreich gelöscht!'
else else
return 'Dieses Zitat existiert nicht.' return 'Dieses Zitat existiert nicht.'
@ -61,11 +59,11 @@ function stille:action(msg, config, matches)
return -- Silent Ignore return -- Silent Ignore
end end
if matches[1] == "addstille" and matches[2] then if matches[1] == "addstille" then
utilities.send_reply(msg, stille:save_stille(msg.text), 'HTML') utilities.send_reply(msg, stille:save_stille(matches[2]), 'HTML')
return return
elseif matches[1] == "delstille" and matches[2] then elseif matches[1] == "delstille" then
utilities.send_reply(msg, stille:delete_stille(msg.text), 'HTML') utilities.send_reply(msg, stille:delete_stille(matches[2]), 'HTML')
return return
elseif matches[1] == "liststille" then elseif matches[1] == "liststille" then
utilities.send_reply(msg, stille:list_stilles()) utilities.send_reply(msg, stille:list_stilles())