some little changes on echo.lua and twitter_send.lua
This commit is contained in:
parent
2827c774ce
commit
90f0f782ed
@ -6,8 +6,6 @@ end
|
|||||||
return {
|
return {
|
||||||
description = "Wiederholt euch",
|
description = "Wiederholt euch",
|
||||||
usage = "/echo [Satz]",
|
usage = "/echo [Satz]",
|
||||||
patterns = {
|
patterns = {"^/echo (.*)$"},
|
||||||
"^/echo (.*)$"
|
|
||||||
},
|
|
||||||
run = run
|
run = run
|
||||||
}
|
}
|
||||||
|
@ -2,10 +2,10 @@ do
|
|||||||
|
|
||||||
local OAuth = require "OAuth"
|
local OAuth = require "OAuth"
|
||||||
|
|
||||||
local consumer_key = ""
|
local consumer_key = cred_data.tw_consumer_key
|
||||||
local consumer_secret = ""
|
local consumer_secret = cred_data.tw_consumer_secret
|
||||||
local access_token = ""
|
local access_token = cred_data.tw_access_token
|
||||||
local access_token_secret = ""
|
local access_token_secret = cred_data.tw_access_token_secret
|
||||||
|
|
||||||
local client = OAuth.new(consumer_key, consumer_secret, {
|
local client = OAuth.new(consumer_key, consumer_secret, {
|
||||||
RequestToken = "https://api.twitter.com/oauth/request_token",
|
RequestToken = "https://api.twitter.com/oauth/request_token",
|
||||||
@ -30,25 +30,23 @@ function run(msg, matches)
|
|||||||
return "Twitter Access Token Secret is empty, write it in plugins/twitter_send.lua"
|
return "Twitter Access Token Secret is empty, write it in plugins/twitter_send.lua"
|
||||||
end
|
end
|
||||||
|
|
||||||
if not is_sudo(msg) then
|
|
||||||
return "You aren't allowed to send tweets"
|
|
||||||
end
|
|
||||||
|
|
||||||
local response_code, response_headers, response_status_line, response_body =
|
local response_code, response_headers, response_status_line, response_body =
|
||||||
client:PerformRequest("POST", "https://api.twitter.com/1.1/statuses/update.json", {
|
client:PerformRequest("POST", "https://api.twitter.com/1.1/statuses/update.json", {
|
||||||
status = matches[1]
|
status = matches[1]
|
||||||
})
|
})
|
||||||
if response_code ~= 200 then
|
if response_code ~= 200 then
|
||||||
return "Error: "..response_code
|
return "Fehler: "..response_code
|
||||||
end
|
end
|
||||||
return "Tweet sended"
|
local data = json:decode(response_body)
|
||||||
|
return "Tweet gesendet! Sieh ihn dir an: https://twitter.com/TalesOfTelegram/status/"..data.id_str
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
description = "Sends a tweet",
|
description = "Sends a tweet",
|
||||||
usage = "!tw [text]: Sends the Tweet with the configured accout.",
|
usage = "",
|
||||||
patterns = {"^!tw (.+)"},
|
patterns = {"^/tw (.+)"},
|
||||||
run = run
|
run = run,
|
||||||
|
privileged = true
|
||||||
}
|
}
|
||||||
|
|
||||||
end
|
end
|
Reference in New Issue
Block a user