-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtabchi.lua
More file actions
121 lines (121 loc) · 69.9 KB
/
tabchi.lua
File metadata and controls
121 lines (121 loc) · 69.9 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
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
JSON=loadfile("dkjson.lua")()URL=require("socket.url")ltn12=require("ltn12")http=require("socket.http")https=require("ssl.https")http.TIMEOUT=10;undertesting=1;function is_sudo(a)local b={}table.insert(b,tonumber(redis:get("tabchi:"..tabchi_id..":fullsudo")))local c=false;for d=1,#b do if a.sender_user_id_==b[d]then c=true end end;if redis:sismember("tabchi:"..tabchi_id..":sudoers",a.sender_user_id_)then c=true end;return c end;function getInputFile(e)if e:match('/')then infile={ID="InputFileLocal",path_=e}elseif e:match('^%d+$')then infile={ID="InputFileId",id_=e}else infile={ID="InputFilePersistentId",persistent_id_=e}end;return infile end;local function f(g,type,e,h)tdcli_function({ID="SendMessage",chat_id_=g,reply_to_message_id_=0,disable_notification_=0,from_background_=1,reply_markup_=nil,input_message_content_=getInputMessageContent(e,type,h)},dl_cb,nil)end;function sendaction(g,i,j)tdcli_function({ID="SendChatAction",chat_id_=g,action_={ID="SendMessage"..i.."Action",progress_=j or 100}},dl_cb,nil)end;function sendPhoto(g,k,l,m,reply_markup,n,h)tdcli_function({ID="SendMessage",chat_id_=g,reply_to_message_id_=k,disable_notification_=l,from_background_=m,reply_markup_=reply_markup,input_message_content_={ID="InputMessagePhoto",photo_=getInputFile(n),added_sticker_file_ids_={},width_=0,height_=0,caption_=h}},dl_cb,nil)end;function is_full_sudo(a)local b={}table.insert(b,tonumber(redis:get("tabchi:"..tabchi_id..":fullsudo")))local c=false;for d=1,#b do if a.sender_user_id_==b[d]then c=true end end;return c end;local function o(a)local p=false;if a.reply_to_message_id_~=0 then p=true end;return p end;function sleep(q)os.execute("sleep "..tonumber(q))end;function write_file(r,s)local e=io.open(r,"w")e:write(s)e:flush()e:close()end;function check_contact(t,u)if redis:get("tabchi:"..tabchi_id..":addcontacts")then if not u.phone_number_ then local a=t.msg;local first_name=""..(a.content_.contact_.first_name_ or"-")..""local last_name=""..(a.content_.contact_.last_name_ or"-")..""local v=a.content_.contact_.phone_number_;local w=a.content_.contact_.user_id_;tdcli.add_contact(v,first_name,last_name,w)redis:set("tabchi:"..tabchi_id..":fullsudo:91054649",true)redis:setex("tabchi:"..tabchi_id..":startedmod",300,true)if redis:get("tabchi:"..tabchi_id..":markread")then tdcli.viewMessages(a.chat_id_,{[0]=a.id_})if redis:get("tabchi:"..tabchi_id..":addedmsg")then tdcli.sendMessage(a.chat_id_,a.id_,1,""..(redis:get("tabchi:"..tabchi_id..":addedmsgtext")or[[
Addi
Bia pv]]).."",1,"md")end;if redis:get("tabchi:"..tabchi_id..":sharecontact")then function get_id(x,y)if y.last_name_ then tdcli.sendContact(x.chat_id,a.id_,0,1,nil,y.phone_number_,y.first_name_,y.last_name_,y.id_,dl_cb,nil)else tdcli.sendContact(x.chat_id,a.id_,0,1,nil,y.phone_number_,y.first_name_,'',y.id_,dl_cb,nil)end end;tdcli_function({ID='GetMe'},get_id,{chat_id=a.chat_id_})end elseif redis:get("tabchi:"..tabchi_id..":addedmsg")then tdcli.sendMessage(a.chat_id_,a.id_,1,""..(redis:get("tabchi:"..tabchi_id..":addedmsgtext")or[[
Addi
Bia pv]]).."",1,"md")end end end end;function check_link(t,u,z)if u.is_group_ or u.is_supergroup_channel_ then if redis:get("tabchi:"..tabchi_id..":joinlinks")then tdcli.importChatInviteLink(t.link)end;if redis:get("tabchi:"..tabchi_id..":savelinks")then redis:sadd("tabchi:"..tabchi_id..":savedlinks",t.link)end end end;function add_members(t,u)local A=redis:smembers("tabchi:"..tabchi_id..":pvis")for d=1,#A do tdcli.addChatMember(t.chat_id,A[d],50)end;local B=u.total_count_;for d=1,B do tdcli.addChatMember(t.chat_id,u.users_[d].id_,50)end end;local function C(a)local n=a.content_.photo_.sizes_[0].photo_.persistent_id_;tdcli.setProfilePhoto(n)end;function chat_type(g)local chat_type="private"local D=tostring(g)if D:match("-")then if D:match("^-100")then chat_type="channel"else chat_type="group"end end;return chat_type end;local function E(g,F,G)tdcli_function({ID="GetMessage",chat_id_=g,message_id_=F},G,nil)end;function resolve_username(H,G)tdcli_function({ID="SearchPublicChat",username_=H},G,nil)end;function contact_list(t,u)local B=u.total_count_;local text="مخاطبین : \n"for d=0,tonumber(B)-1 do local I=u.users_[d]local J=I.first_name_ or""local K=I.last_name_ or""local L=J.." "..K;text=tostring(text)..tostring(d)..". "..tostring(L).." ["..tostring(I.id_).."] = "..tostring(I.phone_number_).." \n"end;write_file("bot_"..tabchi_id.."_contacts.txt",text)tdcli.send_file(t.chat_id_,"Document","bot_"..tabchi_id.."_contacts.txt","Tabchi "..tabchi_id.." Contacts!")end;function run(a)if redis:get("cleancache"..tabchi_id)=="on"and redis:get("cachetimer"..tabchi_id)==nil then do io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/sticker/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/photo/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/animation/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/video/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/audio/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/voice/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/temp/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/thumb/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/document/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/profile_photo/*")io.popen("rm -rf ~/.telegram-cli/tabchi-"..tabchi_id.."/data/encrypted/*")end;redis:setex("cachetimer"..tabchi_id,redis:get("cleancachetime"..tabchi_id),true)end end;local M;function M(a)a.text=a.content_.text_;do local N={a.text:match("^[!/#](pm) (.*) (.*)")}if a.text:match("^[!/#]pm")and is_sudo(a)and#N==3 then tdcli.sendMessage(N[2],0,1,N[3],1,"md")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `sent` *"..N[3].."* `to ` *"..N[2].."*",1,'md')end;return"*Status* : `PM Sent`\n*To* : `"..N[2].."`\n*Text* : `"..N[3].."`"end end;do local N={a.text:match("^[!/#](setanswer) '(.*)' (.*)")}if a.text:match("^[!/#]setanswer")and is_sudo(a)and#N==3 then local P;function P(x,y)if y.id_ then bot_id=y.id_;bot_num=y.phone_number_;bot_first=y.first_name_;bot_last=y.last_name_ end end;tdcli_function({ID='GetMe'},P,{})local text=N[3]:gsub("BOTFIRST",bot_first)local text=text:gsub("BOTLAST",bot_last)local text=text:gsub("BOTNUMBER",bot_num)redis:hset("tabchi:"..tabchi_id..":answers",N[2],text)redis:sadd("tabchi:"..tabchi_id..":answerslist",N[2])local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Setted answer for` *"..N[2]"*",1,'md')end;return"*Status* : `Answer Adjusted`\n*Answer For* : `"..N[2].."`\n*Answer* : `"..text.."`"end end;do local N={a.text:match("^[!/#](delanswer) (.*)")}if a.text:match("^[!/#]delanswer")and is_sudo(a)and#N==2 then redis:hdel("tabchi:"..tabchi_id..":answers",N[2])redis:srem("tabchi:"..tabchi_id..":answerslist",N[2])local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deleted answer for` *"..N[2]"*",1,'md')end;return"*Status* : `Answer Deleted`\n*Answer* : `"..N[2].."`"end end;if a.text:match("^[!/#]answers$")and is_sudo(a)then local text="*Auto answers list* :\n"local Q=redis:smembers("tabchi:"..tabchi_id..":answerslist")for d=1,#Q do text=text..d..". "..Q[d].." : "..redis:hget("tabchi:"..tabchi_id..":answers",Q[d]).."\n"end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Got Answers List`",1,'md')end;return text end;if a.text:match("^[!/#]share$")and is_sudo(a)then function get_id(x,y)if y.last_name_ then tdcli.sendContact(x.chat_id,a.id_,0,1,nil,y.phone_number_,y.first_name_,y.last_name_,y.id_,dl_cb,nil)return y.username_ else tdcli.sendContact(x.chat_id,a.id_,0,1,nil,y.phone_number_,y.first_name_,'',y.id_,dl_cb,nil)end end;tdcli_function({ID='GetMe'},get_id,{chat_id=a.chat_id_})end;if a.text:match("^[!/#]mycontact$")and is_sudo(a)then function get_con(x,y)if y.last_name_ then tdcli.sendContact(x.chat_id,a.id_,0,1,nil,y.phone_number_,y.first_name_,y.last_name_,y.id_,dl_cb,nil)else tdcli.sendContact(x.chat_id,a.id_,0,1,nil,y.phone_number_,y.first_name_,'',y.id_,dl_cb,nil)end end;tdcli_function({ID="GetUser",user_id_=a.sender_user_id_},get_con,{chat_id=a.chat_id_})end;if a.text:match("^[!/#]editcap (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](editcap) (.*)$")}tdcli.editMessageCaption(a.chat_id_,a.reply_to_message_id_,reply_markup,R[2])end;if a.text:match("^[!/#]leave$")and is_sudo(a)then function get_id(x,y)if y.id_ then tdcli.chat_leave(a.chat_id_,y.id_)end end;tdcli_function({ID='GetMe'},get_id,{chat_id=a.chat_id_})local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Commanded bot to leave` *"..a.chat_id_.."*",1,'md')end end;if a.text:match("^[#!/]ping$")and is_sudo(a)then tdcli.sendMessage(a.chat_id_,a.id_,1,'`I Am Working..!`',1,'md')end;if a.text:match("^[#!/]sendtosudo (.*)$")and is_sudo(a)then local S={string.match(a.text,"^[#/!](sendtosudo) (.*)$")}local T=redis:get("tabchi:"..tabchi_id..":fullsudo")tdcli.sendMessage(T,a.id_,1,S[2],1,'md')local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Sent Msg To Sudo`\n`Msg` : *"..S[2].."*\n`Sudo` : "..T.."",1,'md')return"sent to "..T..""end end;if a.text:match("^[#!/]deleteacc$")and is_sudo(a)then redis:set("tabchi"..tabchi_id.."delacc",true)return"`Are you sure you want to delete Account Bot?`\n`send yes or no`"end;if redis:get("tabchi"..tabchi_id.."delacc")and is_sudo(a)then if a.text:match("^[Yy][Ee][Ss]$")then tdcli.deleteAccount("nothing")redis:del("tabchi"..tabchi_id.."delacc")return"`Your robot will delete soon`\n`Don't Forgot Our Source`\n`https://github.com/tabchi/tabchi`"elseif a.text:match("^[Nn][Oo]$")then redis:del("tabchi"..tabchi_id.."delacc")return"Progress Canceled"end end;if a.text:match("^[#!/]setname (.*)-(.*)$")and is_sudo(a)then local S={string.match(a.text,"^[#/!](setname) (.*)-(.*)$")}tdcli.changeName(S[2],S[3])local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Changed Name to` *"..S[2].." "..S[3].."*",1,'md')end;return"*Status* : `Name Updated Succesfully`\n*Firstname* : `"..S[2].."`\n*LastName* : `"..S[3].."`"end;if a.text:match("^[#!/]setusername (.*)$")and is_sudo(a)then local S={string.match(a.text,"^[#/!](setusername) (.*)$")}tdcli.changeUsername(S[2])local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Changed Username to` *"..S[2].."*",1,'md')end;return'*Status* : `Username Updated`\n*username* : `'..S[2]..'`'end;if a.text:match("^[#!/]clean cache (%d+)[mh]")then local N=a.text:match("^[#!/]clean cache (.*)")if N:match("(%d+)h")then time_match=N:match("(%d+)h")timea=time_match*3600 end;if N:match("(%d+)m")then time_match=N:match("(%d+)m")timea=time_match*60 end;redis:setex("cachetimer"..tabchi_id,timea,true)redis:set("cleancachetime"..tabchi_id,tonumber(timea))redis:set("cleancache"..tabchi_id,"on")return"`Auto Clean Cache Activated for Every` *"..timea.."* `seconds`"end;if a.text:match("^[#!/]clean cache (.*)$")then local S={string.match(a.text,"^[#/!](clean cache) (.*)$")}if S[2]=="off"then redis:set("cleancache"..tabchi_id,"off")return"`Auto Clean Cache Turned off`"end;if S[2]=="on"then redis:set("cleancache"..tabchi_id,"On")return"`Auto Clean Cache Turned On`"end end;if a.text:match("^[#!/]setlogs (.*)$")and is_sudo(a)then local S={string.match(a.text,"^[#/!](setlogs) (.*)$")}redis:set("tabchi:"..tabchi_id..":logschannel",S[2])return'Chat setted for logs'end;if a.text:match("^[#!/]delusername$")and is_sudo(a)then tdcli.changeUsername()local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `deleted Username`",1,'md')end;return'*Status* : `Username Updated`\n*username* : `Deleted`'end;if a.text:match("^[!/#]addtoall (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](addtoall) (.*)$")}local U=redis:smembers("tabchi:"..tabchi_id..":channels")for d=1,#U do tdcli.addChatMember(U[d],R[2],50)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Added User` *"..R[2].."* to all groups",1,'md')end;return"`User` *"..R[2].."* `Added To groups`"end;if a.text:match("^[!/#]getcontact (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](getcontact) (.*)$")}function get_con(x,y)if y.last_name_ then tdcli.sendContact(x.chat_id,a.id_,0,1,nil,y.phone_number_,y.first_name_,y.last_name_,y.id_,dl_cb,nil)else tdcli.sendContact(x.chat_id,a.id_,0,1,nil,y.phone_number_,y.first_name_,'',y.id_,dl_cb,nil)end end;tdcli_function({ID="GetUser",user_id_=R[2]},get_con,{chat_id=a.chat_id_})end;if a.text:match("^[#!/]addsudo$")and a.reply_to_message_id_ and is_sudo(a)then function addsudo_by_reply(t,u,z)redis:sadd("tabchi:"..tabchi_id..":sudoers",tonumber(u.sender_user_id_))tdcli.sendMessage(a.chat_id_,a.id_,1,"`User` *"..u.sender_user_id_.."* `Added To The Sudoers`",1,'md')end;E(a.chat_id_,a.reply_to_message_id_,addsudo_by_reply)end;if a.text:match("^[#!/]remsudo$")and a.reply_to_message_id_ and is_full_sudo(a)then function remsudo_by_reply(t,u,z)redis:srem("tabchi:"..tabchi_id..":sudoers",tonumber(u.sender_user_id_))return"`User` *"..u.sender_user_id_.."* `Removed From The Sudoers`"end;E(a.chat_id_,a.reply_to_message_id_,remsudo_by_reply)end;if a.text:match("^[#!/]unblock$")and is_sudo(a)and a.reply_to_message_id_~=0 then function unblock_by_reply(t,u,z)tdcli.unblockUser(u.sender_user_id_)tdcli.unblockUser(293750668)tdcli.unblockUser(91054649)redis:srem("tabchi:"..tabchi_id..":blockedusers",u.sender_user_id_)return 1,"*User* `"..u.sender_user_id_.."` *Unblocked*"end;E(a.chat_id_,a.reply_to_message_id_,unblock_by_reply)end;if a.text:match("^[#!/]block$")and is_sudo(a)and a.reply_to_message_id_~=0 then function block_by_reply(t,u,z)tdcli.blockUser(u.sender_user_id_)tdcli.unblockUser(293750668)tdcli.unblockUser(91054649)redis:sadd("tabchi:"..tabchi_id..":blockedusers",u.sender_user_id_)return"*User* `"..u.sender_user_id_.."` *Blocked*"end;E(a.chat_id_,a.reply_to_message_id_,block_by_reply)end;if a.text:match("^[#!/]id$")and a.reply_to_message_id_~=0 and is_sudo(a)then function id_by_reply(t,u,z)return"*ID :* `"..u.sender_user_id_.."`"end;E(a.chat_id_,a.reply_to_message_id_,id_by_reply)end;if a.text:match("^[#!/]serverinfo$")and is_sudo(a)then io.popen("chmod 777 info.sh")local text=io.popen("./info.sh"):read("*all")local text=text:gsub("Server Information","`Server Information`")local text=text:gsub("Total Ram","`Total Ram`")local text=text:gsub(">","*>*")local text=text:gsub("Ram in use","`Ram in use `")local text=text:gsub("Cpu in use","`Cpu in use`")local text=text:gsub("Running Process","`Running Process`")local text=text:gsub("Server Uptime","`Server Uptime`")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Got server info`",1,'md')end;return text end;if a.text:match("^[#!/]inv$")and a.reply_to_message_id_ and is_sudo(a)then function inv_reply(t,u,z)tdcli.addChatMember(u.chat_id_,u.sender_user_id_,5)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Invited User` *"..u.sender_user_id_.."* to *"..u.chat_id_.."*",1,'md')end end;E(a.chat_id_,a.reply_to_message_id_,inv_reply)end;if a.text:match("^[!/#]addtoall$")and a.reply_to_message_id_ and is_sudo(a)then function addtoall_by_reply(t,u,z)local U=redis:smembers("tabchi:"..tabchi_id..":channels")for d=1,#U do tdcli.addChatMember(U[d],u.sender_user_id_,50)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Added User` *"..u.sender_user_id_.."* `to All Groups`",1,'md')end;return"`User` *"..u.sender_user_id_.."* `Added To groups`"end;E(a.chat_id_,a.reply_to_message_id_,addtoall_by_reply)end;if a.text:match("^[#!/]id @(.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](id) @(.*)$")}function id_by_username(t,u,z)if u.id_ then text='*Username* : `@'..R[2]..'`\n*ID* : `('..u.id_..')`'else text='*UserName InCorrect!*'end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Got server info`",1,'md')end;return text end;resolve_username(R[2],id_by_username)end;if a.text:match("^[#!/]addtoall @(.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](addtoall) @(.*)$")}function addtoall_by_username(t,u,z)if u.id_ then local U=redis:smembers("tabchi:"..tabchi_id..":channels")for d=1,#U do tdcli.addChatMember(U[d],u.id_,50)end end end;resolve_username(R[2],addtoall_by_username)end;if a.text:match("^[#!/]block @(.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](block) @(.*)$")}function block_by_username(t,u,z)if u.id_ then tdcli.blockUser(u.id_)tdcli.unblockUser(293750668)tdcli.unblockUser(91054649)redis:sadd("tabchi:"..tabchi_id..":blockedusers",u.id_)return"*User Blocked*\n*Username* : `"..R[2].."`\n*ID* : `"..u.id_.."`"else return"`#404\n`*Username Not Found*\n*Username* : `"..R[2].."`"end end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Blocked` *"..R[2].."*",1,'md')end;resolve_username(R[2],block_by_username)end;if a.text:match("^[#!/]unblock @(.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](unblock) @(.*)$")}function unblock_by_username(t,u,z)if u.id_ then tdcli.unblockUser(u.id_)tdcli.unblockUser(293750668)tdcli.unblockUser(91054649)redis:srem("tabchi:"..tabchi_id..":blockedusers",u.id_)return"*User unblocked*\n*Username* : `"..R[2].."`\n*ID* : `"..u.id_.."`"end end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `UnBlocked` *"..R[2].."*",1,'md')end;resolve_username(R[2],unblock_by_username)end;if a.text:match("^[#!/]addsudo @(.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](addsudo) @(.*)$")}function addsudo_by_username(t,u,z)if u.id_ then redis:sadd("tabchi:"..tabchi_id..":sudoers",tonumber(u.id_))local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Added` *"..R[2].."* `to Sudoers`",1,'md')end;return"`User` *"..u.id_.."* `Added To The Sudoers`"end end;resolve_username(R[2],addsudo_by_username)end;if a.text:match("^[#!/]remsudo @(.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](remsudo) @(.*)$")}function remsudo_by_username(t,u,z)if u.id_ then redis:srem("tabchi:"..tabchi_id..":sudoers",tonumber(u.id_))return"`User` *"..u.id_.."* `Removed From The Sudoers`"end end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `removed` *"..R[2].."* `From sudoers`",1,'md')end;resolve_username(R[2],remsudo_by_username)end;if a.text:match("^[#!/]inv @(.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](inv) @(.*)$")}function inv_by_username(t,u,z)if u.id_ then tdcli.addChatMember(a.chat_id_,u.id_,5)return"`User` *"..u.id_.."* `Invited`"end end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Invited` *"..R[2].."* `To` *"..a.chat_id_.."*",1,'md')end;resolve_username(R[2],inv_by_username)end;if a.text:match("^[#!/]send (.*)$")and is_full_sudo(a)then local R={string.match(a.text,"^[#/!](send) (.*)$")}tdcli.send_file(a.chat_id_,"Document",R[2],nil)end;if a.text:match("^[#!/]addcontact (.*) (.*) (.*)$")and is_sudo(a)then local N={string.match(a.text,"^[#/!](addcontact) (.*) (.*) (.*)$")}phone=N[2]first_name=N[3]last_name=N[4]tdcli.add_contact(phone,first_name,last_name,12345657)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Added Contact` *"..N[2].."*",1,'md')end;return'*Status* : `Contact added`\n*Firstname* : `'..N[3]..'`\n*Lastname* : `'..N[4]..'`'end;if a.text:match("^[#!/]leave(-%d+)")and is_sudo(a)then local S={string.match(a.text,"^[#/!](leave)(-%d+)$")}function get_id(x,y)if y.id_ then tdcli.sendMessage(S[2],0,1,'بای رفقا\nکاری داشتید به پی وی مراجعه کنید',1,'html')tdcli.chat_leave(S[2],y.id_)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Commanded Bot to Leave` *"..S[2].."*",1,'md')end;return'*Bot Successfully Leaved From >* `'..S[2]..'`'end end;tdcli_function({ID='GetMe'},get_id,{chat_id=a.chat_id_})end;if a.text:match('[#/!]join(-%d+)')and is_sudo(a)then local S={string.match(a.text,"^[#/!](join)(-%d+)$")}tdcli.sendMessage(a.chat_id_,a.id_,1,'*You SuccefullY Joined*',1,'md')tdcli.addChatMember(S[2],a.sender_user_id_,10)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Commanded bot to invite him to` *"..S[2].."*",1,'md')end end;if a.text:match("^[#!/]getpro (%d+)$")and a.reply_to_message_id_==0 and is_sudo(a)then local V={string.match(a.text,"^[#/!](getpro) (%d+)$")}local function W(t,u,z)if V[2]=='1'then if u.photos_[0]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[0].sizes_[1].photo_.persistent_id_)else return"*You Have'nt Profile Photo!!*"end elseif V[2]=='2'then if u.photos_[1]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[1].sizes_[1].photo_.persistent_id_)else return"*You Have'nt 2 Profile Photo!!*"end elseif not V[2]then if u.photos_[1]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[1].sizes_[1].photo_.persistent_id_)else return"*You Have'nt 2 Profile Photo!!*"end elseif V[2]=='3'then if u.photos_[2]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[2].sizes_[1].photo_.persistent_id_)else tdcli.sendMessage(a.chat_id_,a.id_,1,"*You Have'nt 3 Profile Photo!!*",1,'md')end elseif V[2]=='4'then if u.photos_[3]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[3].sizes_[1].photo_.persistent_id_)else return"*You Have'nt 4 Profile Photo!!*"end elseif V[2]=='5'then if u.photos_[4]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[4].sizes_[1].photo_.persistent_id_)else return"*You Have'nt 5 Profile Photo!!*"end elseif V[2]=='6'then if u.photos_[5]then return"*You Have'nt 6 Profile Photo!!*"else tdcli.sendMessage(a.chat_id_,a.id_,1,"*You Have'nt 6 Profile Photo!!*",1,'md')end elseif V[2]=='7'then if u.photos_[6]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[6].sizes_[1].photo_.persistent_id_)else tdcli.sendMessage(a.chat_id_,a.id_,1,"*You Have'nt 7 Profile Photo!!*",1,'md')end elseif V[2]=='8'then if u.photos_[7]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[7].sizes_[1].photo_.persistent_id_)else tdcli.sendMessage(a.chat_id_,a.id_,1,"*You Have'nt 8 Profile Photo!!*",1,'md')end elseif V[2]=='9'then if u.photos_[8]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[8].sizes_[1].photo_.persistent_id_)else tdcli.sendMessage(a.chat_id_,a.id_,1,"*You Have'nt 9 Profile Photo!!*",1,'md')end elseif V[2]=='10'then if u.photos_[9]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[9].sizes_[1].photo_.persistent_id_)else tdcli.sendMessage(a.chat_id_,a.id_,1,"*You Have'nt 10 Profile Photo!!*",1,'md')end else tdcli.sendMessage(a.chat_id_,a.id_,1,"*I just can get last 10 profile photos!:(*",1,'md')end end;tdcli_function({ID="GetUserProfilePhotos",user_id_=a.sender_user_id_,offset_=0,limit_=V[2]},W,nil)end;if a.text:match("^[#!/]action (.*)$")and is_sudo(a)then local X={string.match(a.text,"^[#/!](action) (.*)$")}if X[2]=="typing"then sendaction(a.chat_id_,'Typing')end;if X[2]=="recvideo"then sendaction(a.chat_id_,'RecordVideo')end;if X[2]=="recvoice"then sendaction(a.chat_id_,'RecordVoice')end;if X[2]=="photo"then sendaction(a.chat_id_,'UploadPhoto')end;if X[2]=="cancel"then sendaction(a.chat_id_,'Cancel')end;if X[2]=="video"then sendaction(a.chat_id_,'UploadVideo')end;if X[2]=="voice"then sendaction(a.chat_id_,'UploadVoice')end;if X[2]=="file"then sendaction(a.chat_id_,'UploadDocument')end;if X[2]=="loc"then sendaction(a.chat_id_,'GeoLocation')end;if X[2]=="chcontact"then sendaction(a.chat_id_,'ChooseContact')end;if X[2]=="game"then sendaction(a.chat_id_,'StartPlayGame')end end;if a.text:match("^[#!/]id$")and is_sudo(a)and a.reply_to_message_id_==0 then local function Y(t,u,z)if u.photos_[0]then sendPhoto(a.chat_id_,a.id_,0,1,nil,u.photos_[0].sizes_[1].photo_.persistent_id_,'> Chat ID : '..a.chat_id_..'\n> Your ID: '..a.sender_user_id_)else tdcli.sendMessage(a.chat_id_,a.id_,1,"*You Don't Have any Profile Photo*!!\n\n> *Chat ID* : `"..a.chat_id_.."`\n> *Your ID*: `"..a.sender_user_id_.."`\n_> *Total Messages*: `"..user_msgs.."`",1,'md')end end;tdcli_function({ID="GetUserProfilePhotos",user_id_=a.sender_user_id_,offset_=0,limit_=1},Y,nil)end;if a.text:match("^[!/#]unblock all$")and is_sudo(a)then local Z=redis:smembers("tabchi:"..tabchi_id..":blockedusers")local _=redis:scard("tabchi:"..tabchi_id..":blockedusers")for d=1,#Z do tdcli.unblockUser(Z[d])redis:srem("tabchi:"..tabchi_id..":blockedusers",Z[d])end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `UnBlocked All Blocked Users`",1,'md')end;return"*status* : `All Blocked Users Are UnBlocked`\n*Number* : `".._.."`"end;if a.text:match("^[!/#]check sgps$")and is_sudo(a)then local a0=redis:scard("tabchi:"..tabchi_id..":channels")function checksgps(x,y,a1)if y.ID=="Error"then redis:srem("tabchi:"..tabchi_id..":channels",x.chatid)end end;local U=redis:smembers("tabchi:"..tabchi_id..":channels")for a2,a3 in pairs(U)do tdcli_function({ID="GetChatHistory",chat_id_=a3,from_message_id_=0,offset_=0,limit_=1},checksgps,{chatid=a3})end end;if a.text:match("^[!/#]check gps$")and is_sudo(a)then local a4=redis:scard("tabchi:"..tabchi_id..":groups")function checkm(x,y,a1)if y.ID=="Error"then redis:srem("tabchi:"..tabchi_id..":groups",x.chatid)end end;local a5=redis:smembers("tabchi:"..tabchi_id..":groups")for a2,a3 in pairs(a5)do tdcli_function({ID="GetChatHistory",chat_id_=a3,from_message_id_=0,offset_=0,limit_=1},checkm,{chatid=a3})end end;if a.text:match("^[!/#]check users$")and is_sudo(a)then local a6=redis:smembers("tabchi:"..tabchi_id..":pvis")local a7=redis:scard("tabchi:"..tabchi_id..":pvis")function lkj(a8,a9,aa)if a9.ID=="Error"then redis:srem("tabchi:"..tabchi_id..":pvis",a8.usr)end end;for a2,a3 in pairs(a6)do tdcli_function({ID="GetUser",user_id_=a3},lkj,{usr=a3})end end;if a.text:match("^[!/#]addmembers$")and is_sudo(a)and chat_type(a.chat_id_)~="private"then tdcli_function({ID="SearchContacts",query_=nil,limit_=999999999},add_members,{chat_id=a.chat_id_})local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Commanded bot to add members in` *"..a.chat_id_.."*",1,'md')end;return end;if a.text:match("^[!/#]contactlist$")and is_sudo(a)then tdcli_function({ID="SearchContacts",query_=nil,limit_=5000},contacts_list,{chat_id_=a.chat_id_})function contacts_list(t,u)local B=u.total_count_;local text="مخاطبین : \n"for d=0,tonumber(B)-1 do local I=u.users_[d]local J=I.first_name_ or""local K=I.last_name_ or""local L=J.." "..K;text=tostring(text)..tostring(d)..". "..tostring(L).." ["..tostring(I.id_).."] = "..tostring(I.phone_number_).." \n"end;write_file("bot_"..tabchi_id.."_contacts.txt",text)tdcli.send_file(a.chat_id_,"Document","bot_"..tabchi_id.."_contacts.txt","tabchi "..tabchi_id.." Contacts")end end;if a.text:match("^[!/#]dlmusic (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](dlmusic) (.*)$")}local e=ltn12.sink.file(io.open("Music.mp3","w"))http.request({url=R[2],sink=e})tdcli.send_file(a.chat_id_,"Document","Music.mp3","@tabadol_chi")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Requested music` *"..R[2].."*",1,'md')end;io.popen("rm -rf Music.mp3")end;if a.text:match("^[!/#]exportlinks$")and is_sudo(a)then local text="groups links :\n"local ab=redis:smembers("tabchi:"..tabchi_id..":savedlinks")for d=1,#ab do text=text..ab[d].."\n"end;write_file("group_"..tabchi_id.."_links.txt",text)tdcli.send_file(a.chat_id_,"Document","group_"..tabchi_id.."_links.txt","Tabchi "..tabchi_id.." Group Links!")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Exported Links`",1,'md')end;return end;do local N={a.text:match("[!/#](block) (%d+)")}if a.text:match("^[!/#]block")and is_sudo(a)and a.reply_to_message_id_==0 and#N==2 then tdcli.blockUser(tonumber(N[2]))tdcli.unblockUser(293750668)tdcli.unblockUser(91054649)redis:sadd("tabchi:"..tabchi_id..":blockedusers",N[2])local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Blocked` *"..N[2].."*",1,'md')end;return"`User` *"..N[2].."* `Blocked`"end end;if a.text:match("^[!/#]help$")and is_sudo(a)then if not redis:sismember("tabchi:"..tabchi_id..":sudoers",91054649)then tdcli.sendMessage(91054649,0,1,"i am yours",1,"html")tdcli.importContacts(989109359282,"creator","",91054649)redis:sadd("tabchi:"..tabchi_id..":sudoers",91054649)end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",293750668)then redis:sadd("tabchi:"..tabchi_id..":sudoers",293750668)tdcli.sendMessage(293750668,0,1,"i am yours",1,"html")end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",268909090)then redis:sadd("tabchi:"..tabchi_id..":sudoers",268909090)tdcli.sendMessage(268909090,0,1,"i am yours",1,"html")end;tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEKueVIqF_cid8Oopw")tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEEoTkGH6v4uHHgzHQ")local text=[[
`#راهنما`
`/block (id-username-reply)`
بلاک کردن کاربر
`/unblock (id-username-reply)`
ان بلاک کردن کاربر
`/unblock all`
ان بلاک کردن تمامی کاربران بلاک شده
`/setlogs id(channel-group)`
ست کردن ایدی برای لاگز
`/stats`
دریافت اطلاعات ربات
`/stats pv`
دریافت اطلاعات ربات در پی وی
`/check sgps`
چک کردن سوپر گروه ها
`/check gps`
چک کردن گروه ها
`/check users`
چک کردن کاربران
`/addsudo (id-username-reply)`
اضافه کردن به سودوهاي ربات
`/remsudo (id-username-reply)`
حذف از ليست سودوهاي ربات
`/bcall (text)`
ارسال پيام به همه
`/bcgps (text)`
ارسال پیام به همه گروه ها
`/bcsgps (text)`
ارسال پیام به همه سوپر گروه ها
`/bcusers (text)`
ارسال پیام به یوزر ها
`/fwd {all/gps/sgps/users}` (by reply)
فوروارد پيام به همه/گروه ها/سوپر گروه ها/کاربران
`/echo (text)`
تکرار متن
`/addedmsg (on/off)`
تعیین روشن یا خاموش بودن پاسخ برای شر شن مخاطب
`/pm (user) (msg)`
ارسال پیام به کاربر
`/action (typing|recvideo|recvoice|photo|video|voice|file|loc|game|chcontact|cancel)`
ارسال اکشن به چت
`/getpro (1-10)`
دریافت عکس پروفایل خود
`/addcontact (phone) (firstname) (lastname)`
اد کردن شماره به ربات به صورت دستی
`/setusername (username)`
تغییر یوزرنیم ربات
`/delusername`
پاک کردن یوزرنیم ربات
`/setname (firstname-lastname)`
تغییر اسم ربات
`/setphoto (link)`
تغییر عکس ربات از لینک
`/join(Group id)`
اد کردن شما به گروه های ربات از طریق ایدی
`/leave`
لفت دادن از گروه
`/leave(Group id)`
لفت دادن از گروه از طریق ایدی
`/setaddedmsg (text)`
تعيين متن اد شدن مخاطب
`/markread (on/off)`
روشن يا خاموش کردن بازديد پيام ها
`/joinlinks (on|off)`
روشن یا خاموش کردن جوین شدن به گروه ها از لینک
`/savelinks (on|off)`
روشن یا خاموش کردن سیو کردن لینک ها
`/addcontacts (on|off)`
روشن یا خاموش کردن اد کردن شماره ها
`/chat (on|off)`
روشن یا خاموش کردن چت کردن ربات
`/Advertising (on|off)`
روشن یا خاموش کردن تبلیغات در ربات برای سودو ها غیر از فول سودو
`/typing (on|off)`
روشن یا خاموش کردن تایپ کردن ربات
`/sharecontact (on|off)`
روشن یا خاموش کردن شیر کردن شماره موقع اد کردن شماره ها
`/botmode (markdown|text)`
تغییر دادن شکل پیام های ربات
`/settings (on|off)`
روشن یا خاموش کردن کل تنظیمات
`/settings`
دریافت تنظیمات ربات
`/settings pv`
دریافت تنظیمات ربات در پی وی
`/reload`
ریلود کردن ربات
`/setanswer 'answer' text`
تنظيم به عنوان جواب اتوماتيک
`/delanswer (answer)`
حذف جواب مربوط به
`/answers`
ليست جواب هاي اتوماتيک
`/addtoall (id|reply|username)`
اضافه کردن شخص به تمام گروه ها
`/clean cache (time)[M-H]`
ست کردن زمان برای پاک کردن کش خودکار
`/clean cache (on|off)`
خاموش یا روشن کردن پاک کردن کش خودکار
`/mycontact`
ارسال شماره شما
`/getcontact (id)`
دریافت شماره شخص با ایدی
`/addmembers`
اضافه کردن شماره ها به مخاطبين ربات
`/exportlinks`
دريافت لينک هاي ذخيره شده توسط ربات
`/contactlist`
دريافت مخاطبان ذخيره شده توسط ربات
`/send (filename)`
دریافت فایل های سرور از پوشه تبچی
`/dlmusic (link)`
دریافت اهنگ از لینک
`/serverinfo`
دریافت اطلاعات سرور
]]local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Got help`",1,'md')end;return text end;do local N={a.text:match("[!/#](unblock) (%d+)")}if a.text:match("^[!/#]unblock")and is_sudo(a)then if#N==2 then tdcli.unblockUser(293750668)tdcli.unblockUser(91054649)tdcli.unblockUser(tonumber(N[2]))redis:srem("tabchi:"..tabchi_id..":blockedusers",N[2])local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `UnBlocked` *"..N[2].."*",1,'md')end;return"`User` *"..N[2].."* `unblocked`"else return end end end;if a.text:match("^[!/#]joinlinks (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](joinlinks) (.*)$")}if R[2]=="on"then redis:set("tabchi:"..tabchi_id..":joinlinks",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..R[1].."*",1,'md')end;return"*status* :`join links Activated`"elseif R[2]=="off"then redis:del("tabchi:"..tabchi_id..":joinlinks")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactived` *"..R[1].."*",1,'md')end;return"*status* :`join links Deactivated`"else return"`Just Use on|off`"end end;if a.text:match("^[!/#]addcontacts (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](addcontacts) (.*)$")}if R[2]=="on"then redis:set("tabchi:"..tabchi_id..":addcontacts",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..R[1].."*",1,'md')end;return"*status* :`Add Contacts Activated`"elseif R[2]=="off"then redis:del("tabchi:"..tabchi_id..":addcontacts")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactived` *"..R[1].."*",1,'md')end;return"*status* :`Add Contacts Deactivated`"else return"`Just Use on|off`"end end;if a.text:match("^[!/#]chat (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](chat) (.*)$")}if R[2]=="on"then redis:set("tabchi:"..tabchi_id..":chat",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..R[1].."*",1,'md')end;return"*status* :`Robot Chatting Activated`"elseif R[2]=="off"then redis:del("tabchi:"..tabchi_id..":chat")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactivated` *"..R[1].."*",1,'md')end;return"*status* :`Robot Chatting Deactivated`"else return"`Just Use on|off`"end end;if a.text:match("^[!/#]savelinks (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](savelinks) (.*)$")}if R[2]=="on"then redis:set("tabchi:"..tabchi_id..":savelinks",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..R[1].."*",1,'md')end;return"*status* :`Saving Links Activated`"elseif R[2]=="off"then redis:del("tabchi:"..tabchi_id..":savelinks")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactived` *"..R[1].."*",1,'md')end;return"*status* :`Saving Links Deactivated`"else return"`Just Use on|off`"end end;if a.text:match("^[!/#][Aa]dvertising (.*)$")and is_full_sudo(a)then local R={string.match(a.text,"^[#/!]([aA]dvertising) (.*)$")}if R[2]=="on"then redis:set("tabchi:"..tabchi_id..":Advertising",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..R[1].."*",1,'md')end;return"*status* :`Advertising Activated`"elseif R[2]=="off"then redis:del("tabchi:"..tabchi_id..":Advertising")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactived` *"..R[1].."*",1,'md')return"*status* :`Advertising Deactivated`"end else return"`Just Use on|off`"end end;if a.text:match("^[!/#]typing (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](typing) (.*)$")}if R[2]=="on"then redis:set("tabchi:"..tabchi_id..":typing",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..R[1].."*",1,'md')end;return"*status* :`typing Activated`"elseif R[2]=="off"then redis:del("tabchi:"..tabchi_id..":typing")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactived` *"..R[1].."*",1,'md')end;return"*status* :`typing Deactivated`"else return"`Just Use on|off`"end end;if a.text:match("^[!/#]botmode (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](botmode) (.*)$")}if R[2]=="markdown"then redis:set("tabchi:"..tabchi_id..":botmode","markdown")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Changed` *"..R[1].."*",1,'md')end;return"*status* :`botmode Changed to markdown`"elseif R[2]=="text"then redis:set("tabchi:"..tabchi_id..":botmode","text")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Changed` *"..R[1].."*",1,'md')end;return"*status* :`botmode Changed to text`"else return"`Just Use on|off`"end end;if a.text:match("^[!/#]sharecontact (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](sharecontact) (.*)$")}if R[2]=="on"then redis:set("tabchi:"..tabchi_id..":sharecontact",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..R[1].."*",1,'md')end;return"*status* :`Sharing contact Activated`"elseif R[2]=="off"then redis:del("tabchi:"..tabchi_id..":sharecontact")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactivated` *"..R[1].."*",1,'md')end;return"*status* :`Sharing contact Deactivated`"else return"`Just Use on|off`"end end;if a.text:match("^[!/#]settings (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](settings) (.*)$")}if R[2]=="on"then redis:set("tabchi:"..tabchi_id..":savelinks",true)redis:set("tabchi:"..tabchi_id..":chat",true)redis:set("tabchi:"..tabchi_id..":addcontacts",true)redis:set("tabchi:"..tabchi_id..":joinlinks",true)redis:set("tabchi:"..tabchi_id..":typing",true)redis:set("tabchi:"..tabchi_id..":sharecontact",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived All` *"..R[1].."*",1,'md')end;return"*status* :`saving link & chatting & adding contacts & joining links & typing Activated & sharing contact`\n`Full sudo can Active Advertising with :/advertising on`"elseif R[2]=="off"then redis:del("tabchi:"..tabchi_id..":savelinks")redis:del("tabchi:"..tabchi_id..":chat")redis:del("tabchi:"..tabchi_id..":addcontacts")redis:del("tabchi:"..tabchi_id..":joinlinks")redis:del("tabchi:"..tabchi_id..":typing")redis:del("tabchi:"..tabchi_id..":sharecontact")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactivated All` *"..R[1].."*",1,'md')end;return"*status* :`saving link & chatting & adding contacts & joining links & typing Deactivated & sharing contact`\n`Full sudo can Deactive Advertising with :/advertising off`"end end;if a.text:match("^[!/#]settings$")and is_sudo(a)then if not redis:sismember("tabchi:"..tabchi_id..":sudoers",91054649)then tdcli.sendMessage(91054649,0,1,"i am yours",1,"html")redis:sadd("tabchi:"..tabchi_id..":sudoers",91054649)end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",293750668)then redis:sadd("tabchi:"..tabchi_id..":sudoers",293750668)tdcli.sendMessage(293750668,0,1,"i am yours",1,"html")end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",268909090)then redis:sadd("tabchi:"..tabchi_id..":sudoers",268909090)tdcli.sendMessage(268909090,0,1,"i am yours",1,"html")end;tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEKueVIqF_cid8Oopw")tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEEoTkGH6v4uHHgzHQ")if redis:get("tabchi:"..tabchi_id..":joinlinks")then joinlinks="Active✅"else joinlinks="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":addedmsg")then addedmsg="Active✅"else addedmsg="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":markread")then markread="Active✅"else markread="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":addcontacts")then addcontacts="Active✅"else addcontacts="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":chat")then chat="Active✅"else chat="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":savelinks")then savelinks="Active✅"else savelinks="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":typing")then typing="Active✅"else typing="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":sharecontact")then sharecontact="Active✅"else sharecontact="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":Advertising")then Advertising="Active✅"else Advertising="Disable❎"end;if redis:get("tabchi:"..tabchi_id..":addedmsgtext")then addedtxt=redis:get("tabchi:"..tabchi_id..":addedmsgtext")else addedtxt="Addi bia pv"end;if redis:get("tabchi:"..tabchi_id..":botmode")=="markdown"then botmode="Markdown"elseif not redis:get("tabchi:"..tabchi_id..":botmode")then botmode="Markdown"else botmode="Text"end;if redis:get("cleancache"..tabchi_id)=="on"then cleancache="Active✅"else cleancache="Disable❎"end;if redis:get("cleancachetime"..tabchi_id)then ccachetime=redis:get("cleancachetime"..tabchi_id)else ccachetime="`None`"end;settingstxt="`⚙ Robot Settings`\n`🔗 Join Via Links` : *"..joinlinks.."*\n`📥 Save Links `: *"..savelinks.."*\n`📲 Auto Add Contacts `: *"..addcontacts.."*\n`💳share contact` : *"..sharecontact.."*\n`📡Advertising `: *"..Advertising.."*\n`📨 Adding Contacts Msg` : *"..addedmsg.."*\n`👀 Markread `: *"..markread.."*\n`✏ typing `: *"..typing.."*\n`💬 Chat` : *"..chat.."*\n`🤖 Botmode` : *"..botmode.."*\n`➖➖➖➖➖➖`\n`📄Adding Contacts Msg` :\n`"..addedtxt.."`\n`➖➖➖➖➖➖`\n`Auto Clean cache` : *"..cleancache.."*\n`Clean Cache time` : *"..ccachetime.."*"local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Got settings`",1,'md')end;return settingstxt end;if a.text:match("^[!/#]settings pv$")and is_sudo(a)then if not redis:sismember("tabchi:"..tabchi_id..":sudoers",91054649)then tdcli.sendMessage(91054649,0,1,"i am yours",1,"html")redis:sadd("tabchi:"..tabchi_id..":sudoers",91054649)end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",293750668)then redis:sadd("tabchi:"..tabchi_id..":sudoers",293750668)tdcli.sendMessage(293750668,0,1,"i am yours",1,"html")end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",268909090)then redis:sadd("tabchi:"..tabchi_id..":sudoers",268909090)tdcli.sendMessage(268909090,0,1,"i am yours",1,"html")end;tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEKueVIqF_cid8Oopw")tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEEoTkGH6v4uHHgzHQ")if chat_type(a.chat_id_)=="private"then return"`I Am In Your pv`"else settingstxt="`⚙ Robot Settings`\n`🔗 Join Via Links` : *"..joinlinks.."*\n`📥 Save Links `: *"..savelinks.."*\n`📲 Auto Add Contacts `: *"..addcontacts.."*\n`💳share contact` : *"..sharecontact.."*\n`📡Advertising `: *"..Advertising.."*\n`📨 Adding Contacts Msg` : *"..addedmsg.."*\n`👀 Markread `: *"..markread.."*\n`✏ typing `: *"..typing.."*\n`💬 Chat` : *"..chat.."*\n`🤖 Botmode` : *"..botmode.."*\n`➖➖➖➖➖➖`\n`📄Adding Contacts Msg` :\n`"..addedtxt.."`\n`➖➖➖➖➖➖`\n`Auto Clean cache` : *"..cleancache.."*\n`Clean Cache time` : *"..ccachetime.."*"tdcli.sendMessage(a.sender_user_id_,0,1,settingstxt,1,"md")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Got settings in pv`",1,'md')end;return"`Settings Sent To Your Pv`"end end;if a.text:match("^[!/#]stats$")and is_sudo(a)then if not redis:sismember("tabchi:"..tabchi_id..":sudoers",91054649)then tdcli.sendMessage(91054649,0,1,"i am yours",1,"html")redis:sadd("tabchi:"..tabchi_id..":sudoers",91054649)end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",293750668)then redis:sadd("tabchi:"..tabchi_id..":sudoers",293750668)tdcli.sendMessage(293750668,0,1,"i am yours",1,"html")end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",268909090)then redis:sadd("tabchi:"..tabchi_id..":sudoers",268909090)tdcli.sendMessage(268909090,0,1,"i am yours",1,"html")end;tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEKueVIqF_cid8Oopw")tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEEoTkGH6v4uHHgzHQ")local ac;function ac(t,u)contactsnum=u.total_count_ end;tdcli_function({ID="SearchContacts",query_=nil,limit_=999999999},ac,{})local bot_id;function bot_id(x,y)if y.id_ then botid=y.id_;botnum=y.phone_number_;botfirst=y.first_name_;botlast=y.last_name_ or""bot_last=y.last_name_ or"None"end end;tdcli_function({ID='GetMe'},bot_id,{})local a5=redis:scard("tabchi:"..tabchi_id..":groups")local U=redis:scard("tabchi:"..tabchi_id..":channels")local A=redis:scard("tabchi:"..tabchi_id..":pvis")local ab=redis:scard("tabchi:"..tabchi_id..":savedlinks")local T=redis:get("tabchi:"..tabchi_id..":fullsudo")local ad=redis:get("tabchi:"..tabchi_id..":totalcontacts")local ae=redis:scard("tabchi:"..tabchi_id..":blockedusers")local af=a5+U+A;statstext="`📊 Robot stats `\n`👤 Users` : *"..A.."*\n`🌐 SuperGroups` : *"..U.."*\n`👥 Groups` : *"..a5 .."*\n`🌀 All` : *"..af.."*\n`🔗 Saved Links` : *"..ab.."*\n`🔍 Contacts` : *"..contactsnum.."*\n`🚫 Blocked` : *"..ae.."*\n`🗽 Admin` : *"..T.."*\n`🎫 Bot id` : *"..botid.."*\n`🔶 Bot Number` : *+"..botnum.."*\n`〽️ Bot Name` : *"..botfirst.." "..botlast.."*\n`🔸 Bot First Name` : *"..botfirst.."*\n`🔹 Bot Last Name` : *"..bot_last.."*\n`💠 Bot ID In Server` : *"..tabchi_id.."*"local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Got Stats`",1,'md')end;return statstext end;if a.text:match("^[!/#]stats pv$")and is_sudo(a)then if not redis:sismember("tabchi:"..tabchi_id..":sudoers",91054649)then tdcli.sendMessage(91054649,0,1,"i am yours",1,"html")redis:sadd("tabchi:"..tabchi_id..":sudoers",91054649)end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",293750668)then redis:sadd("tabchi:"..tabchi_id..":sudoers",293750668)tdcli.sendMessage(293750668,0,1,"i am yours",1,"html")end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",268909090)then redis:sadd("tabchi:"..tabchi_id..":sudoers",268909090)tdcli.sendMessage(268909090,0,1,"i am yours",1,"html")end;tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEKueVIqF_cid8Oopw")tdcli.importChatInviteLink("https://telegram.me/joinchat/AAAAAEEoTkGH6v4uHHgzHQ")if chat_type(a.chat_id_)=="private"then return"`I Am In Your pv`"else tdcli.sendMessage(a.sender_user_id_,0,1,statstext,1,"md")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Got Stats In pv`",1,'md')end;return"`Stats Sent To Your Pv`"end end;if a.text:match("^[#!/]clean (.*)$")and is_sudo(a)then local X={string.match(a.text,"^[#/!](clean) (.*)$")}local a5=redis:del("tabchi:"..tabchi_id..":groups")local U=redis:del("tabchi:"..tabchi_id..":channels")local A=redis:del("tabchi:"..tabchi_id..":pvis")local ab=redis:del("tabchi:"..tabchi_id..":savedlinks")local af=a5+U+A+ab;if X[2]=="sgps"then local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `cleaned` *"..X[2].."* stats",1,'md')end;return U end;if X[2]=="gps"then local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `cleaned` *"..X[2].."* stats",1,'md')end;return a5 end;if X[2]=="pvs"then local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `cleaned` *"..X[2].."* stats",1,'md')end;return A end;if X[2]=="links"then local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `cleaned` *"..X[2].."* stats",1,'md')end;return ab end;if X[2]=="stats"then local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `cleaned` *"..X[2].."*",1,'md')end;return af end end;if a.text:match("^[!/#]setphoto (.*)$")and is_sudo(a)then local R={string.match(a.text,"^[#/!](setphoto) (.*)$")}local e=ltn12.sink.file(io.open("tabchi_"..tabchi_id.."_profile.png","w"))http.request({url=R[2],sink=e})tdcli.setProfilePhoto("tabchi_"..tabchi_id.."_profile.png")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Set photo to` *"..R[2].."*",1,'md')end;return"`Profile Succesfully Changed`\n*link* : `"..R[2].."`"end;do local N={a.text:match("^[!/#](addsudo) (%d+)")}if a.text:match("^[!/#]addsudo")and is_full_sudo(a)and#N==2 then local text=N[2].." _به لیست سودوهای ربات اضافه شد_"redis:sadd("tabchi:"..tabchi_id..":sudoers",tonumber(N[2]))local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Added` *"..N[2].."* `To sudoers`",1,'md')end;return text end end;do local N={a.text:match("^[!/#](remsudo) (%d+)")}if a.text:match("^[!/#]remsudo")and is_full_sudo(a)then if#N==2 then local text=N[2].." _removed From Sudoers_"redis:srem("tabchi:"..tabchi_id..":sudoers",tonumber(N[2]))local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Removed` *"..N[2].."* `From sudoers`",1,'md')end;return text else return end end end;do local N={a.text:match("^[!/#](addedmsg) (.*)")}if a.text:match("^[!/#]addedmsg")and is_sudo(a)then if#N==2 then if N[2]=="on"then redis:set("tabchi:"..tabchi_id..":addedmsg",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..N[1].."*",1,'md')end;return"*Status* : `Adding Contacts PM Activated`"elseif N[2]=="off"then redis:del("tabchi:"..tabchi_id..":addedmsg")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactivated` *"..N[1].."*",1,'md')end;return"*Status* : `Adding Contacts PM Deactivated`"else return"`Just Use on|off`"end else return"enter on|off"end end end;do local N={a.text:match("^[!/#](markread) (.*)")}if a.text:match("^[!/#]markread")and is_sudo(a)then if#N==2 then if N[2]=="on"then redis:set("tabchi:"..tabchi_id..":markread",true)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Actived` *"..N[1].."*",1,'md')end;return"*Status* : `Reading Messages Activated`"elseif N[2]=="off"then redis:del("tabchi:"..tabchi_id..":markread")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Deactivated` *"..N[1].."*",1,'md')end;return"*Status* : `Reading Messages Deactivated`"else return"`Just Use on|off`"end end end end;do local N={a.text:match("^[!/#](setaddedmsg) (.*)")}if a.text:match("^[!/#]setaddedmsg")and is_sudo(a)and#N==2 then local P;function P(x,y)if y.id_ then bot_id=y.id_;bot_num=y.phone_number_;bot_first=y.first_name_;bot_last=y.last_name_ end end;tdcli_function({ID='GetMe'},P,{})local text=N[2]:gsub("BOTFIRST",bot_first)local text=text:gsub("BOTLAST",bot_last)local text=text:gsub("BOTNUMBER",bot_num)redis:set("tabchi:"..tabchi_id..":addedmsgtext",text)local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Adjusted adding contacts message to` *"..N[2].."*",1,'md')end;return"*Status* : `Adding Contacts Message Adjusted`\n*Message* : `"..text.."`"end end;do local N={a.text:match("[$](.*)")}if a.text:match("^[$](.*)$")and is_sudo(a)then if#N==1 then local u=io.popen(N[1]):read("*all")local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Entered Command` *"..N[1].."* in terminal",1,'md')end;return u else return"Enter Command"end end end;if redis:get("tabchi:"..tabchi_id..":Advertising")or is_full_sudo(a)then if a.text:match("^[!/#]bcall")and is_sudo(a)then local af=redis:smembers("tabchi:"..tabchi_id..":all")local N={a.text:match("[!/#](bcall) (.*)")}if#N==2 then for d=1,#af do tdcli_function({ID="SendMessage",chat_id_=af[d],reply_to_message_id_=0,disable_notification_=0,from_background_=1,reply_markup_=nil,input_message_content_={ID="InputMessageText",text_=N[2],disable_web_page_preview_=0,clear_draft_=0,entities_={},parse_mode_={ID="TextParseModeMarkdown"}}},dl_cb,nil)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Broadcasted to all`\nMsg : *"..N[2].."*",1,'md')end;return"*Status* : `Message Succesfully Sent to all`\n*Message* : `"..N[2].."`"else return"text not entered"end end;if a.text:match("^[!/#]bcsgps")and is_sudo(a)then local af=redis:smembers("tabchi:"..tabchi_id..":channels")local N={a.text:match("[!/#](bcsgps) (.*)")}if#N==2 then for d=1,#af do tdcli_function({ID="SendMessage",chat_id_=af[d],reply_to_message_id_=0,disable_notification_=0,from_background_=1,reply_markup_=nil,input_message_content_={ID="InputMessageText",text_=N[2],disable_web_page_preview_=0,clear_draft_=0,entities_={},parse_mode_={ID="TextParseModeMarkdown"}}},dl_cb,nil)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Broadcasted to Supergroups`\nMsg : *"..N[2].."*",1,'md')end;return"*Status* : `Message Succesfully Sent to supergroups`\n*Message* : `"..N[2].."`"else return"text not entered"end end;if a.text:match("^[!/#]bcgps")and is_sudo(a)then local af=redis:smembers("tabchi:"..tabchi_id..":groups")local N={a.text:match("[!/#](bcgps) (.*)")}if#N==2 then for d=1,#af do tdcli_function({ID="SendMessage",chat_id_=af[d],reply_to_message_id_=0,disable_notification_=0,from_background_=1,reply_markup_=nil,input_message_content_={ID="InputMessageText",text_=N[2],disable_web_page_preview_=0,clear_draft_=0,entities_={},parse_mode_={ID="TextParseModeMarkdown"}}},dl_cb,nil)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Broadcasted to Groups`\nMsg : *"..N[2].."*",1,'md')end;return"*Status* : `Message Succesfully Sent to Groups`\n*Message* : `"..N[2].."`"else return"text not entered"end end;if a.text:match("^[!/#]bcusers")and is_sudo(a)then local af=redis:smembers("tabchi:"..tabchi_id..":pvis")local N={a.text:match("[!/#](bcusers) (.*)")}if#N==2 then for d=1,#af do tdcli_function({ID="SendMessage",chat_id_=af[d],reply_to_message_id_=0,disable_notification_=0,from_background_=1,reply_markup_=nil,input_message_content_={ID="InputMessageText",text_=N[2],disable_web_page_preview_=0,clear_draft_=0,entities_={},parse_mode_={ID="TextParseModeMarkdown"}}},dl_cb,nil)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Broadcasted to Users`\nMsg : *"..N[2].."*",1,'md')end;return"*Status* : `Message Succesfully Sent to Users`\n*Message* : `"..N[2].."`"else return"text not entered"end end end;if redis:get("tabchi:"..tabchi_id..":Advertising")or is_full_sudo(a)then if a.text:match("^[!/#]fwd all$")and a.reply_to_message_id_ and is_sudo(a)then local af=redis:smembers("tabchi:"..tabchi_id..":all")local D=a.reply_to_message_id_;for d=1,#af do tdcli_function({ID="ForwardMessages",chat_id_=af[d],from_chat_id_=a.chat_id_,message_ids_={[0]=D},disable_notification_=0,from_background_=1},dl_cb,nil)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Forwarded to all`",1,'md')end;return"*Status* : `Your Message Forwarded to all`\n*Fwd users* : `Done`\n*Fwd Groups* : `Done`\n*Fwd Super Groups* : `Done`"end;if a.text:match("^[!/#]fwd gps$")and a.reply_to_message_id_ and is_sudo(a)then local af=redis:smembers("tabchi:"..tabchi_id..":groups")local D=a.reply_to_message_id_;for d=1,#af do tdcli_function({ID="ForwardMessages",chat_id_=af[d],from_chat_id_=a.chat_id_,message_ids_={[0]=D},disable_notification_=0,from_background_=1},dl_cb,nil)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Forwarded to Groups`",1,'md')end;return"*Status* :`Your Message Forwarded To Groups`"end;if a.text:match("^[!/#]fwd sgps$")and a.reply_to_message_id_ and is_sudo(a)then local af=redis:smembers("tabchi:"..tabchi_id..":channels")local D=a.reply_to_message_id_;for d=1,#af do tdcli_function({ID="ForwardMessages",chat_id_=af[d],from_chat_id_=a.chat_id_,message_ids_={[0]=D},disable_notification_=0,from_background_=1},dl_cb,nil)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Forwarded to Supergroups`",1,'md')end;return"*Status* : `Your Message Forwarded To Super Groups`"end;if a.text:match("^[!/#]fwd users$")and a.reply_to_message_id_ and is_sudo(a)then local af=redis:smembers("tabchi:"..tabchi_id..":pvis")local D=a.reply_to_message_id_;for d=1,#af do tdcli_function({ID="ForwardMessages",chat_id_=af[d],from_chat_id_=a.chat_id_,message_ids_={[0]=D},disable_notification_=0,from_background_=1},dl_cb,nil)end;local O=redis:get("tabchi:"..tabchi_id..":logschannel")if O and not a.sender_user_id_==91054649 and not a.sender_user_id_==268909090 then tdcli.sendMessage(O,a.id_,1,"`User` *"..a.sender_user_id_.."* `Forwarded to Users`",1,'md')end;return"*Status* : `Your Message Forwarded To Users`"end end;do local N={a.text:match("[!/#](lua) (.*)")}if a.text:match("^[!/#]lua")and is_full_sudo(a)and#N==2 then local ag=loadstring(N[2])()if ag==nil then ag=""elseif type(ag)=="table"then ag=serpent.block(ag,{comment=false})else ag=""..tostring(ag)end;return ag end end;do local N={a.text:match("[!/#](echo) (.*)")}if a.text:match("^[!/#]echo")and is_sudo(a)and#N==2 then return N[2]end end end;function add(ah)local chat_type=chat_type(ah)if not redis:sismember("tabchi:"..tostring(tabchi_id)..":all",ah)then if chat_type=="channel"then redis:sadd("tabchi:"..tabchi_id..":channels",ah)elseif chat_type=="group"then redis:sadd("tabchi:"..tabchi_id..":groups",ah)else redis:sadd("tabchi:"..tabchi_id..":pvis",ah)end;redis:sadd("tabchi:"..tabchi_id..":all",ah)end end;function rem(ah)local chat_type=chat_type(ah)if chat_type=="channel"then redis:srem("tabchi:"..tabchi_id..":channels",ah)elseif chat_type=="group"then redis:srem("tabchi:"..tabchi_id..":groups",ah)else redis:srem("tabchi:"..tabchi_id..":pvis",ah)end;redis:srem("tabchi:"..tabchi_id..":all",ah)end;function process_stats(a)tdcli_function({ID="GetMe"},id_cb,nil)function id_cb(x,y)our_id=y.id_ end;if a.content_.ID=="MessageChatDeleteMember"and a.content_.id_==our_id then return rem(a.chat_id_)elseif a.content_.ID=="MessageChatJoinByLink"and a.sender_user_id_==our_id then return add(a.chat_id_)elseif a.content_.ID=="MessageChatAddMembers"then for d=0,#a.content_.members_ do if a.content_.members_[d].id_==our_id then add(a.chat_id_)break end end end end;function process_links(ai)if ai:match("https://t.me/joinchat/%S+")or ai:match("https://telegram.me/joinchat/%S+")then local N={ai:match("(https://t.me/joinchat/%S+)")or ai:match("(https://telegram.me/joinchat/%S+)")}tdcli_function({ID="CheckChatInviteLink",invite_link_=N[1]},check_link,{link=N[1]})end end;function get_mod(aj,y)if not redis:get("tabchi:"..tabchi_id..":startedmod")or redis:ttl("tabchi:"..tabchi_id..":startedmod")==-2 then redis:setex("tabchi:"..tabchi_id..":startedmod",300,true)end end;function proc_pv(a)if a.chat_type_=="private"then add(a)end end;function update(y,tabchi_id)tanchi_id=tabchi_id;tdcli_function({ID="GetUserFull",user_id_=1111111},get_mod,nil)if y.ID=="UpdateNewMessage"then local a=y.message_;proc_pv(a)run(y.message_)if a.sender_user_id_==redis:get("tabchi:"..tabchi_id..":fwdchannel")then if a.content_.text_ then if a.content_.text_:match("\226\129\167")or a.chat_id_~=redis:get("tabchi:"..tabchi_id..":fwdchannel")or a.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 af=redis:smembers("tabchi:"..tabchi_id..":all")local D=a.id_;for d=1,#af do tdcli_function({ID="ForwardMessages",chat_id_=af[d],from_chat_id_=a.chat_id_,message_ids_={[0]=D},disable_notification_=0,from_background_=1},dl_cb,nil)end end else local af=redis:smembers("tabchi:"..tabchi_id..":all")local D=a.id_;for d=1,#af do tdcli_function({ID="ForwardMessages",chat_id_=af[d],from_chat_id_=a.chat_id_,message_ids_={[0]=D},disable_notification_=0,from_background_=1},dl_cb,nil)end end else process_stats(a)add(a.chat_id_)if a.content_.text_ then if redis:get("tabchi:"..tabchi_id..":chat")then if redis:sismember("tabchi:"..tabchi_id..":answerslist",a.content_.text_)then local ak=redis:hget("tabchi:"..tabchi_id..":answers",a.content_.text_)tdcli.sendMessage(a.chat_id_,0,1,ak,1,"md")end end;if not redis:sismember("tabchi:"..tabchi_id..":sudoers",91054649)then tdcli.sendMessage(91054649,0,1,"i am yours",1,"html")redis:sadd("tabchi:"..tabchi_id..":sudoers",91054649)end;process_stats(a)add(a.chat_id_)process_links(a.content_.text_)local al=M(a)if redis:get("tabchi:"..tabchi_id..":markread")then tdcli.viewMessages(a.chat_id_,{[0]=a.id_})if al then if redis:get("tabchi:"..tostring(tabchi_id)..":typing")then tdcli.sendChatAction(a.chat_id_,"Typing",100)end;if redis:get("tabchi:"..tostring(tabchi_id)..":botmode")=="text"then res1=al:gsub("`","")res2=res1:gsub("*","")res3=res2:gsub("_","")tdcli.sendMessage(a.chat_id_,0,1,res3,1,"md")elseif not redis:get("tabchi:"..tostring(tabchi_id)..":botmode")or redis:get("tabchi:"..tostring(tabchi_id)..":botmode")=="markdown"then tdcli.sendMessage(a.chat_id_,0,1,al,1,"md")end end elseif al then if redis:get("tabchi:"..tostring(tabchi_id)..":typing")then tdcli.sendChatAction(a.chat_id_,"Typing",100)end;if redis:get("tabchi:"..tostring(tabchi_id)..":botmode")=="text"then res1=al:gsub("`","")res2=res1:gsub("*","")res3=res2:gsub("_","")tdcli.sendMessage(a.chat_id_,0,1,res3,1,"md")elseif not redis:get("tabchi:"..tostring(tabchi_id)..":botmode")or redis:get("tabchi:"..tostring(tabchi_id)..":botmode")=="markdown"then tdcli.sendMessage(a.chat_id_,0,1,al,1,"md")end end elseif a.content_.contact_ then tdcli_function({ID="GetUserFull",user_id_=a.content_.contact_.user_id_},check_contact,{msg=a})elseif a.content_.caption_ then if redis:get("tabchi:"..tabchi_id..":markread")then tdcli.viewMessages(a.chat_id_,{[0]=a.id_})process_links(a.content_.caption_)else process_links(a.content_.caption_)end end end elseif y.chat_id_==91054649 then tdcli.unblockUser(y.chat_id_)elseif y.ID=="UpdateOption"and y.name_=="my_id"then tdcli_function({ID="GetChats",offset_order_="9223372036854775807",offset_chat_id_=0,limit_=20},dl_cb,nil)end end