chat id example for boersedown.lua
This commit is contained in:
parent
17a14d34c0
commit
f46036adc4
1
.gitignore
vendored
1
.gitignore
vendored
@ -38,4 +38,3 @@ plugins/vimeo.lua
|
||||
plugins/vine.lua
|
||||
plugins/youtube_playlist.lua
|
||||
plugins/yandere.lua
|
||||
plugins/e621.lua
|
@ -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
|
||||
|
@ -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
|
Reference in New Issue
Block a user