chat id example for boersedown.lua

This commit is contained in:
Akamaru 2015-05-10 20:29:40 +02:00
parent 17a14d34c0
commit f46036adc4
3 changed files with 2 additions and 40 deletions

3
.gitignore vendored
View File

@ -37,5 +37,4 @@ plugins/spotify.lua
plugins/vimeo.lua
plugins/vine.lua
plugins/youtube_playlist.lua
plugins/yandere.lua
plugins/e621.lua
plugins/yandere.lua

View File

@ -3,7 +3,7 @@ socket = require("socket")
function cron()
-- Use yours desired web and id
local addr = "www.boerse.to"
local dest = "chat#id11215880"
local dest = "chat#id12345678"
-- Checks a TCP connexion
local connexion = socket.connect(addr, 80)
if not connexion then

View File

@ -1,37 +0,0 @@
-- This is a proprietary plugin, property of Andreas Bielawski, (c) 2015 <andi (dot) b (at) outlook (dot) de>
-- DO NOT USE WITHOUT PERMISSION
-- Modified by Akamaru (http://akamaru.de)
do
local function get_e621(tag)
local BASE_URL = 'https://e621.net'
local url = BASE_URL..'/post/index.json?tag='..tag
local b,c = https.request(url)
if c ~= 200 then return nil end
local e621 = json:decode(b)
-- truly randomize
math.randomseed(os.time())
-- random max json table size
local i = math.random(#e621)
local link_image = e621[i].file_url
return link_image
end
local function run(msg, matches)
local tag = matches[1]
local receiver = get_receiver(msg)
local url = get_e621(tag)
send_photo_from_url(receiver, url, send_title, {receiver, title})
--return "Source: "..url
return "Bild wird gesendet!"
end
return {
description = "Sendet zufälliges Bild von e621.",
usage = {"/e621 [Tags]"},
patterns = {"^/e621 (.*)$"},
run = run
}
end