commit
0483edb0c3
@ -8,15 +8,15 @@ local triggers = {
|
||||
local action = function(msg)
|
||||
|
||||
-- Filthy hack, but here is where we'll stop forwarded messages from hitting
|
||||
-- other plugins.
|
||||
-- Other plugins.
|
||||
if msg.forward_from then return end
|
||||
|
||||
local message = config.about_text .. '\nBased on @otouto v'..version..' by topkecleon.'
|
||||
local output = config.about_text .. '\nBased on @otouto v'..version..' by topkecleon.'
|
||||
|
||||
if (msg.new_chat_participant and msg.new_chat_participant.id == bot.id)
|
||||
or msg.text_lower:match('^/about[@'..bot.username..']*')
|
||||
or msg.text_lower:match('^/start') then
|
||||
sendMessage(msg.chat.id, message, true)
|
||||
sendMessage(msg.chat.id, output, true)
|
||||
return
|
||||
end
|
||||
|
||||
|
@ -13,25 +13,25 @@ local fullnames = { "Wimbledon Tennismatch", "Rinkydink Curdlesnoot", "Butawhite
|
||||
|
||||
local firstnames = { "Bumblebee", "Bandersnatch", "Broccoli", "Rinkydink", "Bombadil", "Boilerdang", "Bandicoot", "Fragglerock", "Muffintop", "Congleton", "Blubberdick", "Buffalo", "Benadryl", "Butterfree", "Burberry", "Whippersnatch", "Buttermilk", "Beezlebub", "Budapest", "Boilerdang", "Blubberwhale", "Bumberstump", "Bulbasaur", "Cogglesnatch", "Liverswort", "Bodybuild", "Johnnycash", "Bendydick", "Burgerking", "Bonaparte", "Bunsenburner", "Billiardball", "Bukkake", "Baseballmitt", "Blubberbutt", "Baseballbat", "Rumblesack", "Barister", "Danglerack", "Rinkydink", "Bombadil", "Honkytonk", "Billyray", "Bumbleshack", "Snorkeldink", "Anglerfish", "Beetlejuice", "Bedlington", "Bandicoot", "Boobytrap", "Blenderdick", "Bentobox", "Anallube", "Pallettown", "Wimbledon", "Buttercup", "Blasphemy", "Snorkeldink", "Brandenburg", "Barbituate", "Snozzlebert", "Tiddleywomp", "Bouillabaisse", "Wellington", "Benetton", "Bendandsnap", "Timothy", "Brewery", "Bentobox", "Brandybuck", "Benjamin", "Buckminster", "Bourgeoisie", "Bakery", "Oscarbait", "Buckyball", "Bourgeoisie", "Burlington", "Buckingham", "Barnoldswick" }
|
||||
|
||||
local lastnames = { "Coddleswort", "Crumplesack", "Curdlesnoot", "Calldispatch", "Humperdinck", "Rivendell", "Cuttlefish", "Lingerie", "Vegemite", "Ampersand", "Cumberbund", "Candycrush", "Clombyclomp", "Cragglethatch", "Nottinghill", "Cabbagepatch", "Camouflage","Creamsicle", "Curdlemilk", "Upperclass", "Frumblesnatch", "Crumplehorn", "Talisman", "Candlestick", "Chesterfield", "Bumbersplat", "Scratchnsniff", "Snugglesnatch", "Charizard", "Carrotstick", "Cumbercooch", "Crackerjack", "Crucifix", "Cuckatoo", "Cockletit", "Collywog", "Capncrunch", "Covergirl", "Cumbersnatch", "Countryside","Coggleswort", "Splishnsplash", "Copperwire", "Animorph", "Curdledmilk", "Cheddarcheese", "Cottagecheese", "Crumplehorn", "Snickersbar", "Banglesnatch", "Stinkyrash", "Cameltoe", "Chickenbroth", "Concubine", "Candygram", "Moldyspore", "Chuckecheese", "Cankersore", "Crimpysnitch", "Wafflesmack", "Chowderpants", "Toodlesnoot", "Clavichord", "Cuckooclock", "Oxfordshire", "Cumbersome", "Chickenstrips", "Battleship", "Commonwealth", "Cunningsnatch", "Custardbath", "Kryptonite", "Curdlesnoot", "Cummerbund", "Coochyrash", "Crackerdong", "Crackerdong", "Curdledong", "Crackersprout", "Crumplebutt", "Colonist", "Coochierash", "Thundersnatch" }
|
||||
local lastnames = { "Coddleswort", "Crumplesack", "Curdlesnoot", "Calldispatch", "Humperdinck", "Rivendell", "Cuttlefish", "Lingerie", "Vegemite", "Ampersand", "Cumberbund", "Candycrush", "Clombyclomp", "Cragglethatch", "Nottinghill", "Cabbagepatch", "Camouflage", "Creamsicle", "Curdlemilk", "Upperclass", "Frumblesnatch", "Crumplehorn", "Talisman", "Candlestick", "Chesterfield", "Bumbersplat", "Scratchnsniff", "Snugglesnatch", "Charizard", "Carrotstick", "Cumbercooch", "Crackerjack", "Crucifix", "Cuckatoo", "Cockletit", "Collywog", "Capncrunch", "Covergirl", "Cumbersnatch", "Countryside", "Coggleswort", "Splishnsplash", "Copperwire", "Animorph", "Curdledmilk", "Cheddarcheese", "Cottagecheese", "Crumplehorn", "Snickersbar", "Banglesnatch", "Stinkyrash", "Cameltoe", "Chickenbroth", "Concubine", "Candygram", "Moldyspore", "Chuckecheese", "Cankersore", "Crimpysnitch", "Wafflesmack", "Chowderpants", "Toodlesnoot", "Clavichord", "Cuckooclock", "Oxfordshire", "Cumbersome", "Chickenstrips", "Battleship", "Commonwealth", "Cunningsnatch", "Custardbath", "Kryptonite", "Curdlesnoot", "Cummerbund", "Coochyrash", "Crackerdong", "Crackerdong", "Curdledong", "Crackersprout", "Crumplebutt", "Colonist", "Coochierash", "Thundersnatch" }
|
||||
|
||||
local action = function(msg)
|
||||
|
||||
local message
|
||||
|
||||
if math.random(10) == 10 then
|
||||
message = fullnames[math.random(#fullnames)]
|
||||
output = fullnames[math.random(#fullnames)]
|
||||
else
|
||||
message = firstnames[math.random(#firstnames)] .. ' ' .. lastnames[math.random(#lastnames)]
|
||||
output = firstnames[math.random(#firstnames)] .. ' ' .. lastnames[math.random(#lastnames)]
|
||||
end
|
||||
|
||||
sendReply(msg, message)
|
||||
sendMessage(msg.chat.id, output, true, nil, true)
|
||||
|
||||
end
|
||||
|
||||
return {
|
||||
action = action,
|
||||
triggers = triggers,
|
||||
command = command,
|
||||
desc = desc
|
||||
doc = doc,
|
||||
command = command
|
||||
}
|
||||
|
@ -27,22 +27,22 @@ local action = function(msg)
|
||||
|
||||
local url = 'http://api.biblia.com/v1/bible/content/ASV.txt?key=' .. config.biblia_api_key .. '&passage=' .. URL.escape(input)
|
||||
|
||||
local message, res = HTTP.request(url)
|
||||
local output, res = HTTP.request(url)
|
||||
|
||||
if not message or res ~= 200 or message:len() == 0 then
|
||||
if not output or res ~= 200 or output:len() == 0 then
|
||||
url = 'http://api.biblia.com/v1/bible/content/KJVAPOC.txt?key=' .. config.biblia_api_key .. '&passage=' .. URL.escape(input)
|
||||
message, res = HTTP.request(url)
|
||||
output, res = HTTP.request(url)
|
||||
end
|
||||
|
||||
if not message or res ~= 200 or message:len() == 0 then
|
||||
message = config.errors.results
|
||||
if not output or res ~= 200 or output:len() == 0 then
|
||||
output = config.errors.results
|
||||
end
|
||||
|
||||
if message:len() > 4000 then
|
||||
message = 'The text is too long to post here. Try being more specific.'
|
||||
if output:len() > 4000 then
|
||||
output = 'The text is too long to post here. Try being more specific.'
|
||||
end
|
||||
|
||||
sendReply(msg, message)
|
||||
sendMessage(msg.chat.id, output, true, msg.message_id, true)
|
||||
|
||||
end
|
||||
|
||||
|
@ -28,7 +28,7 @@ local action = function(msg)
|
||||
return
|
||||
end
|
||||
|
||||
output = '`' .. output .. '`'
|
||||
output = '*Result:* `' .. output .. '`'
|
||||
|
||||
sendMessage(msg.chat.id, output, true, msg.message_id, true)
|
||||
|
||||
|
@ -33,7 +33,7 @@ local action = function(msg)
|
||||
local input = msg.text_lower
|
||||
input = input:gsub(bot.first_name, 'simsimi')
|
||||
input = input:gsub('@'..bot.username, 'simsimi')
|
||||
|
||||
|
||||
if config.simsimi_trial then
|
||||
sandbox = 'sandbox.'
|
||||
else
|
||||
@ -53,10 +53,10 @@ local action = function(msg)
|
||||
sendMessage(msg.chat.id, config.errors.chatter_response)
|
||||
return
|
||||
end
|
||||
local message = jdat.response
|
||||
local output = jdat.response
|
||||
|
||||
if message:match('^I HAVE NO RESPONSE.') then
|
||||
message = config.errors.chatter_response
|
||||
if output:match('^I HAVE NO RESPONSE.') then
|
||||
output = config.errors.chatter_response
|
||||
end
|
||||
|
||||
-- Let's clean up the response a little. Capitalization & punctuation.
|
||||
@ -68,14 +68,14 @@ local action = function(msg)
|
||||
}
|
||||
|
||||
for k,v in pairs(filter) do
|
||||
message = string.gsub(message, k, v)
|
||||
output = string.gsub(output, k, v)
|
||||
end
|
||||
|
||||
if not string.match(message, '%p$') then
|
||||
message = message .. '.'
|
||||
if not string.match(output, '%p$') then
|
||||
output = output .. '.'
|
||||
end
|
||||
|
||||
sendMessage(msg.chat.id, message)
|
||||
sendMessage(msg.chat.id, output)
|
||||
|
||||
end
|
||||
|
||||
|
@ -418,7 +418,8 @@ local commits = {
|
||||
|
||||
local action = function(msg)
|
||||
|
||||
sendMessage(msg.chat.id, '`'..commits[math.random(#commits)]..'`', true, nil, true)
|
||||
local output = '*Commit:* '..commits[math.random(#commits)]
|
||||
sendMessage(msg.chat.id, output, true, nil, true)
|
||||
|
||||
end
|
||||
|
||||
|
@ -45,9 +45,8 @@ local action = function(msg)
|
||||
|
||||
end
|
||||
|
||||
local output = amount .. ' ' .. from .. ' = ' .. result .. ' ' .. to .. '\n\n'
|
||||
output = output .. os.date('!%F %T UTC') .. '\nSource: Google Finance'
|
||||
output = '`' .. output .. '`'
|
||||
local output = '*' .. amount .. ' ' .. from .. ' = ' .. result .. ' ' .. to .. '*\n\n'
|
||||
output = output .. '`' .. os.date('!%F %T UTC') .. '\nSource: Google Finance`'
|
||||
|
||||
sendMessage(msg.chat.id, output, true, nil, true)
|
||||
|
||||
|
@ -17,7 +17,7 @@ local action = function(msg)
|
||||
else
|
||||
local output
|
||||
if msg.chat.type == 'supergroup' then
|
||||
output = 'Echo:\n"' .. input .. '"'
|
||||
output = 'Echo:\n"' .. markdown_escape(input) .. '"'
|
||||
else
|
||||
output = latcyr(input)
|
||||
end
|
||||
|
@ -39,15 +39,15 @@ local yesno_answers = {
|
||||
|
||||
local action = function(msg)
|
||||
|
||||
local message
|
||||
local output
|
||||
|
||||
if msg.text_lower:match('y/n%p?$') then
|
||||
message = yesno_answers[math.random(#yesno_answers)]
|
||||
output = yesno_answers[math.random(#yesno_answers)]
|
||||
else
|
||||
message = ball_answers[math.random(#ball_answers)]
|
||||
output = ball_answers[math.random(#ball_answers)]
|
||||
end
|
||||
|
||||
sendReply(msg, message)
|
||||
sendReply(msg, output)
|
||||
|
||||
end
|
||||
|
||||
|
@ -16,8 +16,8 @@ local triggers = {
|
||||
|
||||
local action = function(msg)
|
||||
|
||||
local message = io.popen('fortune'):read('*all')
|
||||
sendMessage(msg.chat.id, message)
|
||||
local output = io.popen('fortune'):read('*all')
|
||||
sendMessage(msg.chat.id, output)
|
||||
|
||||
end
|
||||
|
||||
|
@ -64,7 +64,8 @@ local action = function(msg)
|
||||
|
||||
|
||||
if msg.text:match('nsfw') then
|
||||
sendReply(msg, result)
|
||||
output = 'NSFW Image ' .. output
|
||||
sendMessage(msg.chat.id, output, true, nil, true)
|
||||
else
|
||||
sendMessage(msg.chat.id, output, false, nil, true)
|
||||
end
|
||||
|
@ -13,6 +13,8 @@ local triggers = {
|
||||
|
||||
local action = function(msg)
|
||||
|
||||
sendChatAction(msg.chat.id, "find_location")
|
||||
|
||||
local input = msg.text:input()
|
||||
if not input then
|
||||
if msg.reply_to_message and msg.reply_to_message.text then
|
||||
|
@ -11,8 +11,6 @@ local triggers = {
|
||||
|
||||
local action = function(msg)
|
||||
|
||||
sendChatAction(msg.chat.id, 'typing')
|
||||
|
||||
local jstr, res = HTTPS.request('https://hacker-news.firebaseio.com/v0/topstories.json')
|
||||
if res ~= 200 then
|
||||
sendReply(msg, config.errors.connection)
|
||||
|
@ -38,7 +38,7 @@ local action = function(msg)
|
||||
local output = '[' .. jdat.Title .. '](http://imdb.com/title/'
|
||||
output = output .. jdat.imdbID .. ') ('.. jdat.Year ..')\n'
|
||||
output = output .. jdat.imdbRating ..'/10 | '.. jdat.Runtime ..' | '.. jdat.Genre ..'\n'
|
||||
output = output .. jdat.Plot
|
||||
output = output .. '`' .. jdat.Plot .. '`'
|
||||
|
||||
sendMessage(msg.chat.id, output, true, nil, true)
|
||||
|
||||
|
@ -45,14 +45,14 @@ local action = function(msg)
|
||||
local url = 'http://ws.audioscrobbler.com/2.0/?method=user.getrecenttracks&format=json&limit=1&api_key=' .. config.lastfm_api_key .. '&user='
|
||||
|
||||
local username
|
||||
local output = ''
|
||||
local alert = ''
|
||||
if input then
|
||||
username = input
|
||||
elseif database.users[msg.from.id_str].lastfm then
|
||||
username = database.users[msg.from.id_str].lastfm
|
||||
elseif msg.from.username then
|
||||
username = msg.from.username
|
||||
output = '\n\nYour username has been set to ' .. username .. '.\nTo change it, use /fmset <username>.'
|
||||
alert = '\n\nYour username has been set to ' .. username .. '.\nTo change it, use /fmset <username>.'
|
||||
database.users[msg.from.id_str].lastfm = username
|
||||
else
|
||||
sendReply(msg, 'Please specify your last.fm username or set it with /fmset.')
|
||||
@ -75,17 +75,17 @@ local action = function(msg)
|
||||
|
||||
local jdat = jdat.recenttracks.track[1] or jdat.recenttracks.track
|
||||
if not jdat then
|
||||
sendReply(msg, 'No history for this user.' .. output)
|
||||
sendReply(msg, 'No history for this user.' .. alert)
|
||||
return
|
||||
end
|
||||
|
||||
local message = input or msg.from.first_name
|
||||
message = '🎵 ' .. message
|
||||
local output = input or msg.from.first_name
|
||||
output = '🎵 ' .. output
|
||||
|
||||
if jdat['@attr'] and jdat['@attr'].nowplaying then
|
||||
message = message .. ' is currently listening to:\n'
|
||||
output = output .. ' is currently listening to:\n'
|
||||
else
|
||||
message = message .. ' last listened to:\n'
|
||||
output = output .. ' last listened to:\n'
|
||||
end
|
||||
|
||||
local title = jdat.name or 'Unknown'
|
||||
@ -94,8 +94,8 @@ local action = function(msg)
|
||||
artist = jdat.artist['#text']
|
||||
end
|
||||
|
||||
message = message .. title .. ' - ' .. artist .. output
|
||||
sendMessage(msg.chat.id, message)
|
||||
output = output .. title .. ' - ' .. artist .. alert
|
||||
sendMessage(msg.chat.id, output)
|
||||
|
||||
end
|
||||
|
||||
|
@ -28,10 +28,10 @@ local action = function(msg)
|
||||
if not input then
|
||||
sendMessage(msg.chat.id, doc, true, msg.message_id, true)
|
||||
elseif input == '-' then
|
||||
database.lastfm[msg.from.id_str] = nil
|
||||
database.librefm[msg.from.id_str] = nil
|
||||
sendReply(msg, 'Your libre.fm username has been forgotten.')
|
||||
else
|
||||
database.lastfm[msg.from.id_str] = input
|
||||
database.librefm[msg.from.id_str] = input
|
||||
sendReply(msg, 'Your libre.fm username has been set to "' .. input .. '".')
|
||||
end
|
||||
return
|
||||
@ -40,15 +40,15 @@ local action = function(msg)
|
||||
local url = 'http://alpha.libre.fm/2.0/?method=user.getrecenttracks&format=json&limit=1&api_key=0&user='
|
||||
|
||||
local username
|
||||
local output = ''
|
||||
local alert = ''
|
||||
if input then
|
||||
username = input
|
||||
elseif database.lastfm[msg.from.id_str] then
|
||||
username = database.lastfm[msg.from.id_str]
|
||||
elseif database.librefm[msg.from.id_str] then
|
||||
username = database.librefm[msg.from.id_str]
|
||||
elseif msg.from.username then
|
||||
username = msg.from.username
|
||||
output = '\n\nYour username has been set to ' .. username .. '.\nTo change it, use /lfmset <username>.'
|
||||
database.lastfm[msg.from.id_str] = username
|
||||
alert = '\n\nYour username has been set to ' .. username .. '.\nTo change it, use /lfmset <username>.'
|
||||
database.librefm[msg.from.id_str] = username
|
||||
else
|
||||
sendReply(msg, 'Please specify your libre.fm username or set it with /lfmset.')
|
||||
return
|
||||
@ -70,17 +70,17 @@ local action = function(msg)
|
||||
|
||||
local jdat = jdat.recenttracks.track[1] or jdat.recenttracks.track
|
||||
if not jdat then
|
||||
sendReply(msg, 'No history for this user.' .. output)
|
||||
sendReply(msg, 'No history for this user.' .. alert)
|
||||
return
|
||||
end
|
||||
|
||||
local message = input or msg.from.first_name
|
||||
message = '🎵 ' .. message
|
||||
local output = input or msg.from.first_name
|
||||
output = '🎵 ' .. output
|
||||
|
||||
if jdat['@attr'] and jdat['@attr'].nowplaying then
|
||||
message = message .. ' is currently listening to:\n'
|
||||
output = output .. ' is currently listening to:\n'
|
||||
else
|
||||
message = message .. ' last listened to:\n'
|
||||
output = output .. ' last listened to:\n'
|
||||
end
|
||||
|
||||
local title = jdat.name or 'Unknown'
|
||||
@ -89,8 +89,8 @@ local action = function(msg)
|
||||
artist = jdat.artist['#text']
|
||||
end
|
||||
|
||||
message = message .. title .. ' - ' .. artist .. output
|
||||
sendMessage(msg.chat.id, message)
|
||||
output = output .. title .. ' - ' .. artist .. alert
|
||||
sendMessage(msg.chat.id, output)
|
||||
|
||||
end
|
||||
|
||||
|
@ -39,7 +39,7 @@ local action = function(msg)
|
||||
output = target.name .. '\'s nickname has been set to "' .. input .. '".'
|
||||
end
|
||||
|
||||
sendReply(msg, output)
|
||||
sendMessage(msg.chat.id, output, true, nil, true)
|
||||
|
||||
end
|
||||
|
||||
|
@ -12,8 +12,8 @@ local action = function(msg)
|
||||
local m1, m2 = msg.text:match('^/?s/(.-)/(.-)/?$')
|
||||
if not m2 then return true end
|
||||
output = output:gsub(m1, m2)
|
||||
output = 'Did you mean:\n"' .. output:sub(1, 4000) .. '"'
|
||||
sendReply(msg.reply_to_message, output)
|
||||
output = '*Did you mean:*\n"' .. output:sub(1, 4000) .. '"'
|
||||
sendMessage(msg.chat.id, output, true, msg.message_id, true)
|
||||
|
||||
end
|
||||
|
||||
|
@ -6,7 +6,7 @@ local triggers = {
|
||||
}
|
||||
|
||||
local action = function(msg)
|
||||
sendMessage(msg.chat.id, msg.text_lower:match('^/ping') and 'Pong!' or 'Annyong.')
|
||||
sendMessage(msg.chat.id, msg.text_lower:match('^/ping') and '*Pong!*' or '*Annyong.*', true, nil, true)
|
||||
end
|
||||
|
||||
return {
|
||||
|
@ -71,8 +71,8 @@ local cron = function()
|
||||
-- If the reminder is past-due, send it and nullify it.
|
||||
-- Otherwise, add it to the replacement table.
|
||||
if time > reminder.time then
|
||||
local output = 'Reminder:\n"' .. reminder.message .. '"'
|
||||
local res = sendMessage(chat_id, output, true)
|
||||
local output = '*Reminder:*\n"' .. markdown_escape(reminder.message) .. '"'
|
||||
local res = sendMessage(chat_id, output, true, nil, true)
|
||||
-- If the message fails to send, save it for later.
|
||||
if res then
|
||||
reminder = nil
|
||||
|
@ -41,9 +41,9 @@ local action = function(msg)
|
||||
if utcoff == math.abs(utcoff) then
|
||||
utcoff = '+' .. utcoff
|
||||
end
|
||||
local message = os.date('%I:%M %p\n', timestamp) .. os.date('%A, %B %d, %Y\n', timestamp) .. jdat.timeZoneName .. ' (UTC' .. utcoff .. ')'
|
||||
local output = '`' .. os.date('%I:%M %p\n', timestamp) .. os.date('%A, %B %d, %Y\n', timestamp) .. jdat.timeZoneName .. ' (UTC' .. utcoff .. ')' .. '`'
|
||||
|
||||
sendReply(msg, message)
|
||||
sendMessage(msg.chat.id, output, true, nil, true)
|
||||
|
||||
end
|
||||
|
||||
|
@ -36,9 +36,9 @@ local action = function(msg)
|
||||
end
|
||||
|
||||
local output = jdat.text[1]
|
||||
output = 'Translation:\n"' .. output .. '"'
|
||||
output = '*Translation:*\n"' .. output .. '"'
|
||||
|
||||
sendReply(msg.reply_to_message or msg, output)
|
||||
sendMessage(msg.chat.id, output, true, msg.message_id, true)
|
||||
|
||||
end
|
||||
|
||||
|
@ -48,9 +48,9 @@ local action = function(msg)
|
||||
|
||||
local celsius = string.format('%.2f', jdat.main.temp - 273.15)
|
||||
local fahrenheit = string.format('%.2f', celsius * (9/5) + 32)
|
||||
local message = celsius .. '°C | ' .. fahrenheit .. '°F, ' .. jdat.weather[1].description .. '.'
|
||||
local output = celsius .. '°C | ' .. fahrenheit .. '°F, ' .. jdat.weather[1].description .. '.'
|
||||
|
||||
sendReply(msg, message)
|
||||
sendMessage(msg.chat.id, output, true, msg.message_id, true)
|
||||
|
||||
end
|
||||
|
||||
|
Reference in New Issue
Block a user