Pattern Fixes bei einigen Plugins

This commit is contained in:
Akamaru 2016-07-07 21:34:32 +02:00
parent d612fade97
commit 8fdc1b9ec0
17 changed files with 158 additions and 90 deletions

View File

@ -28,7 +28,7 @@ return {
description = "Sendet ein zufälliges Bild von 9GAG",
usage = "#9gag: Sendet ein zufälliges Bild von 9GAG.",
patterns = {
"^#9gag$"
"^#9[Gg][Aa][Gg]$"
},
run = run
}

View File

@ -13,7 +13,6 @@ local function get_stock (symbol)
end
function send_stock_data(data, receiver)
-- local ask = data.Ask
local bid = data.Bid
local change = data.Change
local percent = data.ChangeinPercent
@ -41,12 +40,10 @@ end
return {
description = "Sendet Aktieninfos",
usage = "#aktien [Symbol]: Sendet Aktieninfos",
usage = "#aktien [Symbol]: Sendet Aktieninfos", "#stocks [Symbol]",
patterns = {
"^#aktien ([A-Za-z0-9]+)$",
"^#stocks ([A-Za-z0-9]+)$",
"^#aktie ([A-Za-z0-9]+)$",
"^#stock ([A-Za-z0-9]+)$"
"^#[Aa][Kk][Tt][Ii][Ee][Nn]? ([A-Za-z0-9]+)$",
"^#[Ss][Tt][Oo][Cc][Kk][Ss]? ([A-Za-z0-9]+)$"
},
run = run
}

View File

@ -1,18 +1,22 @@
do
function run(msg, matches)
local user_name = get_name(msg)
local answers = {'Ja?','Was gibts, ' .. user_name .. '?','Ja ' .. user_name .. ', was ist?',
'Ich bin noch da.', user_name ,'Nein!','So heiße ich'}
'Ich bin noch da.', user_name ,'Nein!','So heiße ich', 'Nerv mich nicht!'}
return answers[math.random(#answers)]
end
return {
description = "Ist der Bot noch da?",
usage = {"Miku"},
patterns = {"^[Mm][Ii][Kk][Uu](?)$",
"^[Mm][Ii][Kk][Uu]$",
"^ミク$",
"^ミク(?)$"
usage = {"Miku", "ミク"},
patterns = {"^[Mm][Ii][Kk][Uu]%??$",
"^ミク%??$"
},
run = run
}
--by Akamaru [https://ponywave.de]
--by Akamaru [https://ponywave.de]
end

View File

@ -100,7 +100,7 @@ local function run(msg, matches)
appid = matches[3]
end
local data = get_appstore_data()
if data == nil then print('Das Appstore-Plugin unterstützt zurzeit nur Apps!') end
if data == nil then print('Das AppStore-Plugin unterstützt derzeit nur Apps!') end
if data == 'HTTP-FEHLER' or data == 'NOTFOUND' then
return 'App nicht gefunden!'
else
@ -109,12 +109,12 @@ local function run(msg, matches)
end
return {
description = "Sendet iPhone App-Store Info.",
description = "Sendet iOS AppStore Info.",
usage = {"Link zu App auf iTunes",
"#itunes (ID)"
},
patterns = {"itunes.apple.com/(.*)/app/(.*)/id(%d+)",
"^#itunes (%d+)$"
"^#[Ii][Tt][Uu][Nn][Ee][Ss] (%d+)$"
},
run = run
}

View File

@ -1,9 +1,11 @@
do
local function get_value(msg, var_name)
local hash = 'telegram:birthdays'
if hash then
local value = redis:hget(hash, var_name)
if not value then
return'Geburtstag nicht gefunden, benutze "/getbd", um alle Geburtstage aufzulisten.'
return'Geburtstag nicht gefunden, benutze "#getbd", um alle Geburtstage aufzulisten.'
else
return var_name..' hat am '..value..' Geburtstag'
end
@ -14,7 +16,7 @@ local function list_variables(msg)
local hash = 'telegram:birthdays'
if hash then
print('Getting variable from redis hash '..hash)
print('Suche nach Geburtstag in '..hash)
local names = redis:hkeys(hash)
local text = ''
for i=1, #names do
@ -38,14 +40,18 @@ local function run(msg, matches)
end
return {
description = "Zeigt Geburtstage, die mit /setbd gesetzt wurden",
description = "Zeigt Geburtstage, die mit #setbd gesetzt wurden",
usage = {
"#getbd: Gibt alle Geburtstage aus",
"#getbd (Name): Gibt den Geburtstag aus."
"#getbd (Name): Gibt ein spezifischen Geburtstag aus."
},
patterns = {
"^(#getbd) (.+)$",
"^#getbd$"
"^(#[Gg][Ee][Tt][Bb][Dd]) (.+)$",
"^#[Gg][Ee][Tt][Bb][Dd]$"
},
run = run
}
}
--by Akamaru [https://ponywave.de]
end

View File

@ -1,3 +1,5 @@
do
local function save_value(msg, name, value)
if (not name or not value) then
return "Benutzung: #setbd [Name] [Tag. Monat]"
@ -5,7 +7,7 @@ local function save_value(msg, name, value)
local hash = 'telegram:birthdays'
if hash then
print('Saving variable to redis hash '..hash)
print('Speicher Geburtstag in '..hash)
redis:hset(hash, name, value)
return "Geburtstag von "..name.." am "..value.." gespeichert!"
end
@ -14,11 +16,11 @@ end
local function delete_value(msg, name)
local hash = 'telegram:birthdays'
if redis:hexists(hash, name) == true then
print('Deleting birthday from redis hash '..hash)
print('Lösche Geburtstag aus '..hash)
redis:hdel(hash, name)
return 'Geburtstag von "'..name..'" erfolgreich gelöscht!'
else
return 'Du kannst keinen Geburtstag löschen, der nicht existiert ._.'
return 'Du kannst keinen Geburtstag löschen, der nicht existiert.'
end
end
@ -41,7 +43,11 @@ return {
"#setbd (Name) nil: Löscht Geburtstag"
},
patterns = {
"^#setbd ([^%s]+) (.+)$"
"^#[Ss][Ee][Tt][Bb][Dd] ([^%s]+) (.+)$"
},
run = run
}
}
--by Akamaru [https://ponywave.de]
end

View File

@ -27,15 +27,16 @@ end
return {
description = "Kürzt einen Link",
usage = {
"/short [Link]: Kürzt einen Link mit Bitly",
"/short [j.mp|bit.ly|bitly.com|andib.tk] [Link]: Kürzt einen Link mit der ausgewählten Kurz-URL"
"#short [Link]: Kürzt einen Link mit Bitly",
"#
short [j.mp|bit.ly|bitly.com|andib.tk] [Link]: Kürzt einen Link mit der ausgewählten Kurz-URL"
},
patterns = {
"^/short (j.mp) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^/short (bit.ly) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^/short (bitly.com) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^/short (andib.tk) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^/short (https?://[%w-_%.%?%.:/%+=&]+)$"
"^#[Ss][Hh][Oo][Rr][Tt] (j.mp) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^#[Ss][Hh][Oo][Rr][Tt] (bit.ly) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^#[Ss][Hh][Oo][Rr][Tt] (bitly.com) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^#[Ss][Hh][Oo][Rr][Tt] (andib.tk) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^#[Ss][Hh][Oo][Rr][Tt] (https?://[%w-_%.%?%.:/%+=&]+)$"
},
run = run
}

View File

@ -40,11 +40,11 @@ end
local function run(msg, matches)
local url = nil
if matches[1] == "#boobs" then
if matches[1] == "#[Bb][Oo][Oo][Bb][Ss]" then
url = getRandomBoobs()
end
if matches[1] == "#butts" then
if matches[1] == "#[Bb][Uu][Tt][Tt][Ss]" then
url = getRandomButts()
end
@ -60,8 +60,8 @@ end
return {
description = "Sendet ein zufälliges Boobs/Butts Bild",
usage = {"#boobs","#butts"},
patterns = {"^#boobs$","^#butts$"},
patterns = {"^#[Bb][Oo][Oo][Bb][Ss]$","^#[Bb][Uu][Tt][Tt][Ss]$"},
run = run
}
end
end

View File

@ -1,3 +1,5 @@
do
-- See https://bitcoinaverage.com/api
local function getBTCX(amount,currency)
local base_url = 'https://api.bitcoinaverage.com/ticker/global/'
@ -25,7 +27,7 @@ local function run(msg, matches)
local amt = nil
-- Get the global match out of the way
if matches[1] == "#btc" then
if matches[1] == "#[Bb][Tt][Cc]" then
return getBTCX(amt,cur)
end
@ -47,11 +49,13 @@ return {
"#btc [EUR|USD] [Menge]: Rechnet Bitcoin in Euro/USD um"
},
patterns = {
"^#btc$",
"^#btc ([Ee][Uu][Rr])$",
"^#btc ([Uu][Ss][Dd])$",
"^#btc (EUR) (%d+[%d%.]*)$",
"^#btc (USD) (%d+[%d%.]*)$"
"^#[Bb][Tt][Cc]$",
"^#[Bb][Tt][Cc] ([Ee][Uu][Rr])$",
"^#[Bb][Tt][Cc] ([Uu][Ss][Dd])$",
"^#[Bb][Tt][Cc] ([Ee][Uu][Rr]) (%d+[%d%.]*)$",
"^#[Bb][Tt][Cc] ([Uu][Ss][Dd]) (%d+[%d%.]*)$"
},
run = run
}
}
end

View File

@ -1,3 +1,5 @@
do
-- Checks if bot was disabled on specific chat
local function is_channel_disabled(msg)
local hash = 'chat:'..msg.to.id..':disabled'
@ -16,7 +18,7 @@ local function enable_channel(msg)
if disabled then
print('Setze Redis Variable "'..hash..'" auf false')
redis:set(hash, false)
return 'Channel aktiviert'
return 'Channel aktiviert!'
else
return 'Channel ist nicht deaktiviert!'
end
@ -28,7 +30,7 @@ local function disable_channel(msg)
if disabled ~= "true" then
print('Setze Redis Variable "'..hash..'" auf true')
redis:set(hash, true)
return 'Channel deaktiviert'
return 'Channel deaktiviert!'
else
return 'Channel ist bereits deaktiviert!'
end
@ -38,7 +40,7 @@ local function pre_process(msg)
-- If is sudo can reeanble the channel
if is_sudo(msg) then
if msg.text == "#channel enable" then
if msg.text == "#[Cc][Hh][Aa][Nn][Nn][Ee][Ll] [Ee][Nn][Aa][Bb][Ll][Ee]" then
enable_channel(msg)
end
end
@ -53,11 +55,11 @@ end
local function run(msg, matches)
-- Enable a channel
if matches[1] == 'enable' then
if matches[1] == '[Ee][Nn][Aa][Bb][Ll][Ee]' then
return enable_channel(msg)
end
-- Disable a channel
if matches[1] == 'disable' then
if matches[1] == '[Dd][Ii][Ss][Aa][Bb][Ll][Ee]' then
return disable_channel(msg)
end
end
@ -69,8 +71,8 @@ return {
"#channel disable: Deaktiviert den Bot im Chat"
},
patterns = {
"^#channel? (enable)",
"^#channel? (disable)"
"^#[Cc][Hh][Aa][Nn][Nn][Ee][Ll] ([Ee][Nn][Aa][Bb][Ll][Ee])",
"^#[Cc][Hh][Aa][Nn][Nn][Ee][Ll] ([Dd][Ii][Ss][Aa][Bb][Ll][Ee])"
},
run = run,
privileged = true,

View File

@ -1,3 +1,5 @@
do
local function chuck()
local random = http.request("http://api.icndb.com/jokes/random")
local decode = json:decode(random)
@ -13,6 +15,8 @@ end
return {
description = "Sendet Chuck Norris Witze (Englisch)",
usage = {"#cn"},
patterns = {"^#cn$"},
patterns = {"^#[Cc][Nn]$"},
run = run
}
}
end

View File

@ -2,7 +2,7 @@ do
function run(msg, matches)
local text = msg.text
local url = "https://andibi.tk/dl/chatter-bot-api/cleverbot.php?text="..URL.escape(text)
local url = "https://brawlbot.tk/apis/chatter-bot-api/cleverbot.php?text="..URL.escape(text)
local query = https.request(url)
if query == nil then return 'Ein Fehler ist aufgetreten :(' end
local decode = json:decode(query)
@ -20,7 +20,9 @@ end
return {
description = "Chat mit CleverBot",
usage = "#cbot [Text]: Befragt den Cleverbot",
patterns = {"^#cbot (.*)$"},
patterns = {
"^#[Cc][Bb][Oo][Tt] (.*)$"
},
run = run
}

View File

@ -1,8 +1,10 @@
do
function run(msg, matches)
cow = matches[1]
local cow = matches[1]
local receiver = get_receiver(msg)
if string.match(msg.text, '"') then
return 'Vergiss es'
if string.match(cow, '"') then
return 'Vergiss es!'
else
local text = run_bash('cowsay "' .. cow .. '"')
send_msg(receiver, text, ok_cb, false)
@ -10,9 +12,11 @@ function run(msg, matches)
end
return {
description = "",
usage = {""},
patterns = {"^#cowsay (.*)$"},
description = "Die sprechende Kuh!",
usage = {"#cowsay [Text]"},
patterns = {"^#[Cc][Oo][Ww][Ss][Aa][Yy] (.*)$"},
run = run
}
--by Akamaru [https://ponywave.de]
--by Akamaru [https://ponywave.de]
end

View File

@ -1,3 +1,5 @@
do
-- This file is part of the Telegram Bot "Brawlbot" (telegram.me/Brawlbot) by Andreas Bielawski (telegram.me/Brawl)
-- Released unter the MPLv2
@ -107,12 +109,14 @@ return {
"#creds rename [Variable] [Neuer Name]: Benennt Variable um, behält Key bei"
},
patterns = {
"^(/creds)$",
"^(/creds add) ([^%s]+) (.+)$",
"^(/creds del) (.+)$",
"^(/creds rename) ([^%s]+) (.+)$"
"^(#creds)$",
"^(#creds add) ([^%s]+) (.+)$",
"^(#creds del) (.+)$",
"^(#creds rename) ([^%s]+) (.+)$"
},
run = run,
privileged = true,
notyping = true
}
}
end

View File

@ -7,11 +7,25 @@ function run(msg, matches)
user_name..' versucht, '..other_user..' mit einem Messer zu töten, stolpert aber und schlitzt sich dabei das Knie auf.',
user_name..' ersticht '..other_user..'.',
user_name..' tritt '..other_user..'.',
user_name..' hat '..other_user..' umgebracht! Möge er in der Hölle schmoren!',
user_name..' hat die Schnauze voll von '..other_user..' und sperrt ihn in einen Schrank.',
user_name..' hat '..other_user..' umgebracht! Möge '..user_name..' in der Hölle schmoren!',
user_name..' hat die Schnauze voll von '..other_user..' und sperrt '..other_user..' in einen Schrank.',
user_name..' erwürgt '..other_user..'. BILD sprach als erstes mit der Hand.',
user_name..' schickt '..other_user..' nach /dev/null.',
user_name..' umarmt '..other_user..'.',
user_name..' schickt '..other_user..' nach /dev/null.',
user_name..' wirft einen Gameboy auf '..other_user..'.',
user_name..' hetzt die NSA auf '..other_user..'.',
user_name..' ersetzt alle CDs von '..other_user..' durch Justin Bieber CDs.',
user_name..' geht mit '..other_user..' zurück in die Zukunft.',
user_name..' geht mit '..other_user..' Gassi.',
user_name..' verkleidet '..other_user..' als Flamingo.',
user_name..' steckt '..other_user..' den Finger in den Po.',
user_name..' schickt '..other_user..' ins Dschungelcamp.',
user_name..' küsst '..other_user..' den Hintern.',
user_name..' küsst '..other_user..' leidenschaftlich.',
user_name..' erwischt '..other_user..' beim Masturbieren.',
user_name..' furzt '..other_user..' ins Gesicht.',
user_name..' schubst '..other_user..' von einer Brücke.',
user_name..' kackt '..other_user..' auf die Stulle.',
user_name..' umarmt '..other_user..'.',
user_name..' verschenkt eine Kartoffel an '..other_user..'.',
user_name..' ist in '..other_user..' verliebt.',
user_name..' schmeißt '..other_user..' in einen Fluss.',
@ -21,7 +35,16 @@ function run(msg, matches)
user_name..' dreht durch und wirft '..other_user..' in einen Häcksler.',
user_name..' gibt '..other_user..' einen Cookie.',
user_name..' lacht '..other_user..' aus.',
user_name..' gibt '..other_user..[[ ganz viel Liebe. ( ͡° ͜ʖ ͡°)]] }
user_name..' gibt '..other_user..[[ ganz viel Liebe. ( ͡° ͜ʖ ͡°)]],
user_name..' lädt '..other_user..' zum Essen ein.',
user_name..' schwätzt '..other_user..' Ubuntu auf.',
user_name..' fliegt mit '..other_user..' nach Hawaii.',
user_name..' melkt '..other_user..'. *muhh*',
user_name..' schaut zusammen mit '..other_user..' My Little Pony.',
user_name..' schickt '..other_user..' nach Bikini Bottom.',
user_name..' beamt '..other_user..' hoch.',
user_name..' und '..other_user..' sind taube Nüsschen. Yeah!',
user_name..' schmiert Hundescheiße auf '..other_user..'s Nike Air.' }
return random[math.random(#random)]
end

View File

@ -1,16 +1,24 @@
do
local function transeng(ger)
ger = string.gsub(ger, 'week,', 'Woche')
ger = string.gsub(ger, 'weeks,', 'Wochen')
ger = string.gsub(ger, 'day,', 'Tag')
ger = string.gsub(ger, 'days,', 'Tage')
ger = string.gsub(ger, 'hour,', 'Stunde')
ger = string.gsub(ger, 'hours,', 'Stunden')
ger = string.gsub(ger, 'minute$', 'Minute')
ger = string.gsub(ger, 'minutes', 'Minuten')
ger = string.gsub(ger, 'week,', 'Woche,')
ger = string.gsub(ger, 'weeks,', 'Wochen,')
ger = string.gsub(ger, 'day,', 'Tag,')
ger = string.gsub(ger, 'days,', 'Tage,')
ger = string.gsub(ger, 'hour,', 'Stunde und')
ger = string.gsub(ger, 'hours,', 'Stunden und')
ger = string.gsub(ger, 'minute$', 'Minute.')
ger = string.gsub(ger, 'minutes', 'Minuten.')
return ger
end
local makeOurDate = function(dateString)
local pattern = "(%d+)%-(%d+)%-(%d+)"
local year, month, day = dateString:match(pattern)
return day..'.'..month..'.'..year
end
local function run(msg, matches)
local receiver = get_receiver(msg)
@ -21,9 +29,10 @@ local function run(msg, matches)
end
if string.match(msg.text, '^#[Uu][Pp][Tt][Ii][Mm][Ee]$') then
cmd = run_bash('uptime -p')
text = transeng('Der PC ist seit '..string.match(cmd, 'up (.*)')..' an')
return text
cmd = run_bash('uptime -s && uptime -p')
text1 = 'Der PC ist seit dem '..makeOurDate(string.match(cmd, '(%d+-%d+-%d+)'))..' an.'
text2 = transeng('Das sind '..string.match(cmd, 'up (.*)'))
return text1..'\n'..text2
end
-- Requires scrot (sudo apt-get install scrot)
@ -49,13 +58,15 @@ end
return {
description = "Führt Befehle in der Konsole aus",
usage = {"#sh [Befehl]","#uptime","#temp","#volt","#takt","#screen","#update","#upgrade"},
usage = {"#sh [Befehl]","#uptime","#screen","#check","#webcam"},
patterns = {"^#[Ss][Hh] (.*)$",
"^#[Uu][Pp][Tt][Ii][Mm][Ee]$",
"^#[Ss][Cc][Rr][Ee][Ee][Nn]$",
"^#[Cc][Hh][Ee][Cc][Kk]$",
"^#[Ww][Ee][Bb][Cc][Aa][Mm]$"
"^#[Ww][Ee][Bb][Cc][Aa][Mm]$"
},
run = run,
privileged = true
}
end

View File

@ -82,7 +82,7 @@ end
local function run(msg, matches)
local user_id = msg.from.id
if matches[1] ~= '/wetter' and matches[1] ~= '/w' then
if matches[1] ~= '#wetter' and matches[1] ~= '#w' then
city = matches[1]
else
local set_location = get_location(user_id)
@ -117,7 +117,7 @@ end
return {
description = "Wetter für deinen oder einen gewählten Ort",
usage = {
"#wetter: Wetter für deinen Wohnort (!location set [Ort])",
"#wetter: Wetter für deinen Wohnort (#location set [Ort])",
"#wetter (Stadt): Wetter für diese Stadt"
},
patterns = {