-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpastebin.lua
More file actions
46 lines (35 loc) · 1.31 KB
/
pastebin.lua
File metadata and controls
46 lines (35 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
--[[
Pastebin
Модуль для мгновенной загрузки текста на pastebin.com
setpkey - Устанавливает ключ, который можно получить зарегистрировавшись на pastebin.com и перейдя на https://pastebin.com/doc_api#1
pbin text - Загружает текст на pastebin.com
by https://t.me/qhxfj
--]]
require "http"
local preferences = inline:getDefaultSharedPreferences()
local function setpkey(_, query)
preferences:edit():putString("pkey", query:getArgs()):apply()
query:answer "Success!"
end
local function pastebin(_, query)
local body = http.buildFormBody(
{
api_dev_key = preferences:getString("pkey", ""),
api_option = "paste",
api_paste_code = query:getArgs()
}
)
request = http.Request.Builder.new():url("https://pastebin.com/api/api_post.php"):post(body):build()
http.call(
request,
function(_, _, data)
query:answer(data)
end
)
end
return function(module)
module:setCategory("Pastebin")
module:registerCommand("pbin", pastebin, "Create new paste with pastebin")
module:registerCommand("setpkey", setpkey, "Sets the pastebin key")
module:saveLazyLoad()
end