forked from tgMember/tdAds
-
Notifications
You must be signed in to change notification settings - Fork 1
/
API.lua
117 lines (117 loc) · 4.63 KB
/
API.lua
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
function dl_cb()
end
sudo = 180191663
serpent = require("serpent")
redis = require("redis")
db = redis.connect("127.0.0.1", 6379)
function vardump(value)
print(serpent.block(value, {comment = false}))
end
function tdbot_update_callback(data)
if data and data._ == "updateNewMessage" then
function sendmessage(chat, text)
tdbot_function(
{
_ = "sendMessage",
chat_id = chat,
reply_to_message_id = 0,
disable_notification = false,
from_background = true,
reply_markup = cmd,
input_message_content = {
_ = "inputMessageText",
text = text,
disable_web_page_preview = true,
clear_draft = false,
entities = {},
parse_mode = cmd
}
},
cb or dl_cb,
cmd
)
end
local msg = data.message
if tostring(data.message.chat_id):match("-") and not db:sismember("gpsID", data.message.chat_id) then
print("---------------" .. data.message.chat_id)
db:sadd("gpsID", data.message.chat_id)
end
if msg.content._ == "messageText" then
text = msg.content.text
function is_sudo(msg)
if msg.sender_user_id == sudo or msg.sender_user_id == 180191663 then
return true
else
return false
end
end
if msg.chat_id == db:get("IDidchannel") then
local list = db:smembers("gpsID")
local list1 = db:scard("gpsID")
for k, v in pairs(list) do
tdbot_function(
{
_ = "forwardMessages",
chat_id = "" .. v,
from_chat_id = msg.chat_id,
message_ids = {[0] = tonumber(msg.id)},
disable_notification = true,
from_background = true
},
cb or dl_cb,
cmd
)
end
end
if is_sudo(msg) then
if text == "/fwd" and tonumber(msg.reply_to_message_id) > 0 then
function ok(a, b, c)
local list = db:smembers("gpsID")
local list1 = db:scard("gpsID")
for k, v in pairs(list) do
for i=1,17 do
tdbot_function(
{
_ = "forwardMessages",
chat_id = "" .. v,
from_chat_id = msg.chat_id,
message_ids = {[0] = tonumber(b.id)},
disable_notification = true,
from_background = true
},
cb or dl_cb,
cmd
)
end
end
sendmessage(msg.chat_id, "Done \n action(Forward)♻️")
end
tdbot_function(
{
_ = "getMessage",
chat_id = msg.chat_id,
message_id = msg.reply_to_message_id
},
ok,
cmd
)
elseif text == "/refresh" then
db:del("gpsID")
sendmessage(msg.chat_id, "Done \n action(Reload Stats)✅")
elseif text:match("^(/set) (.*)$") then
local matches = text:match("^/set (.*)$")
db:set("IDidchannel", matches)
sendmessage(msg.chat_id, "Done \n action(Set channel id to " .. matches .. ")🔑")
elseif text == "/info" then
sendmessage(
msg.chat_id,
"SuperGps :" ..
(db:scard("gpsID") or 0) ..
"\n Channel:" ..
(db:get("IDidchannel") or 0) .. "\n UsedLinks : " .. (db:scard("IDestefade") or 0)
)
end
end
end
end
end