Esempio n. 1
0
def ranks(client, message, redis):
    type = message.chat.type
    userID = message.from_user.id
    chatID = message.chat.id
    rank = isrank(redis, userID, chatID)
    text = message.text
    lang = Glang(redis, chatID)
    moduleCMD = "lang." + lang + "-cmd"
    moduleREPLY = "lang." + lang + "-reply"
    c = importlib.import_module(moduleCMD)
    r = importlib.import_module(moduleREPLY)

    if (rank is "sudo" or rank is "sudos" or rank is "creator"
            or rank is "owner"):
        if re.search(c.admins, text) and Ckuser(message):
            text = text.replace("مسح ", "")
            arrays = redis.smembers("{}Nbot:{}:admin".format(BOT_ID, chatID))
            b = BYusers(arrays, chatID, redis, client)
            kb = InlineKeyboardMarkup([[
                InlineKeyboardButton(r.delList.format(text),
                                     callback_data=json.dumps(
                                         ["delList", "admin", userID]))
            ]])
            if b is not "":
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.showlist.format(text, b),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown",
                        "reply_markup": kb
                    })
            else:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.listempty.format(text),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown"
                    })

        if re.search(c.vips, text) and Ckuser(message):
            text = text.replace("مسح ", "")
            arrays = redis.smembers("{}Nbot:{}:vip".format(BOT_ID, chatID))
            b = BYusers(arrays, chatID, redis, client)
            kb = InlineKeyboardMarkup([[
                InlineKeyboardButton(r.delList.format(text),
                                     callback_data=json.dumps(
                                         ["delList", "vip", userID]))
            ]])
            if b is not "":
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.showlist.format(text, b),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown",
                        "reply_markup": kb
                    })
            else:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.listempty.format(text),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown"
                    })

        orad = redis.hget("{}Nbot:adminor:cb".format(BOT_ID),
                          chatID) or c.setadmin
        orad2 = redis.hget("{}Nbot:adminor:cb2".format(BOT_ID),
                           chatID) or c.setadmin2
        if re.search(c.setadmin + "|" + orad, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.setadmin2 + "|" + orad2, text):
                user = int(re.search(r'\d+', text).group())
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            message.text = c.orad
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = setrank(redis, "admin", userId, chatID, "array")
                if setcr is "admin":
                    send_msg("UD", client, message, r.DsetRK, "", getUser,
                             redis)
                elif (setcr is True or setcr is 1):
                    send_msg("UD", client, message, r.setRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        if re.search(c.remadmin, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.remadmin2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = remrank(redis, "admin", userId, chatID, "array")
                if setcr:
                    send_msg("UD", client, message, r.remRK, "", getUser,
                             redis)
                elif not setcr:
                    send_msg("UD", client, message, r.DremRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        orvip = redis.hget("{}Nbot:vipor:cb".format(BOT_ID),
                           chatID) or c.setvip
        orvip2 = redis.hget("{}Nbot:vipor:cb2".format(BOT_ID),
                            chatID) or c.setvip2
        if re.search(c.setvip + "|" + orvip, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.setvip2 + "|" + orvip2, text):
                user = int(re.search(r'\d+', text).group())
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            message.text = c.orvip
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = setrank(redis, "vip", userId, chatID, "array")
                if setcr is "vip":
                    send_msg("UD", client, message, r.DsetRK, "", getUser,
                             redis)
                elif (setcr is True or setcr is 1):
                    send_msg("UD", client, message, r.setRK, "", getUser,
                             redis)
            except Exception as e:
                import traceback

                traceback.print_exc()
                print(e)
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        if re.search(c.remvip, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.remvip2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = remrank(redis, "vip", userId, chatID, "array")
                if setcr:
                    send_msg("UD", client, message, r.remRK, "", getUser,
                             redis)
                elif not setcr:
                    send_msg("UD", client, message, r.DremRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

    if (rank is "sudo" or rank is "sudos" or rank is "creator"):
        if re.search(c.owners, text) and Ckuser(message):
            text = text.replace("مسح ", "")
            arrays = redis.smembers("{}Nbot:{}:owner".format(BOT_ID, chatID))
            b = BYusers(arrays, chatID, redis, client)
            kb = InlineKeyboardMarkup([[
                InlineKeyboardButton(r.delList.format(text),
                                     callback_data=json.dumps(
                                         ["delList", "owner", userID]))
            ]])
            if b is not "":
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.showlist.format(text, b),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown",
                        "reply_markup": kb
                    })
            else:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.listempty.format(text),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown"
                    })

        orow = redis.hget("{}Nbot:owneror:cb".format(BOT_ID),
                          chatID) or c.setowner
        orow2 = redis.hget("{}Nbot:owneror:cb2".format(BOT_ID),
                           chatID) or c.setowner2
        if re.search(c.setowner + "|" + orow, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.setowner2 + "|" + orow2, text):
                user = int(re.search(r'\d+', text).group())
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            message.text = c.orow
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = setrank(redis, "owner", userId, chatID, "array")
                if setcr is "owner":
                    send_msg("UD", client, message, r.DsetRK, "", getUser,
                             redis)
                elif (setcr is True or setcr is 1):
                    send_msg("UD", client, message, r.setRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        if re.search(c.remowner, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.remowner2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = remrank(redis, "owner", userId, chatID, "array")
                if setcr:
                    send_msg("UD", client, message, r.remRK, "", getUser,
                             redis)
                elif not setcr:
                    send_msg("UD", client, message, r.DremRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })
Esempio n. 2
0
def sudo(client, message,redis):
	type = message.chat.type
	userID = message.from_user.id
	chatID = message.chat.id
	rank = isrank(redis,userID,chatID)
	text = message.text
	title = message.chat.title
	userFN = message.from_user.first_name
	type = message.chat.type
	c = importlib.import_module("lang.arcmd")
	r = importlib.import_module("lang.arreply")
	if redis.hexists("{}Nbot:stepSUDO:or".format(BOT_ID),userID):
		tx = redis.hget("{}Nbot:stepSUDO:or".format(BOT_ID),userID)
		if text :
			redis.sadd("{}Nbot:{}:TXPoeders".format(BOT_ID,chatID),f"{tx}={text}")
			redis.hdel("{}Nbot:stepSUDO:or".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":f"✅꒐ تم اضافه الامر {tx} الى {text}","reply_to_message_id":message.message_id,"parse_mode":"html"})


	if redis.hexists("{}Nbot:stepSUDO".format(BOT_ID),userID):

		
		tx = redis.hget("{}Nbot:stepSUDO".format(BOT_ID),userID)
		if text :
			redis.hset("{}Nbot:TXreplys".format(BOT_ID),tx,text)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRtext.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
		
		if message.sticker:
			ID = message.sticker.file_id
			redis.hset("{}Nbot:STreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRst.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if message.animation:
			ID = message.animation.file_id
			redis.hset("{}Nbot:GFreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRgf.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if message.voice:
			ID = message.voice.file_id
			redis.hset("{}Nbot:VOreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRvo.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if message.photo:
			ID = message.photo.file_id
			redis.hset("{}Nbot:PHreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRph.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
		if message.document:
			ID = message.document.file_id
			redis.hset("{}Nbot:DOreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRfi.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})



	if text and (type is "supergroup" or type is "group"):
		if rank == "sudo":
			if text == "وضع مجموعه المطور":
				redis.set("{}Nbot:sudogp".format(BOT_ID),chatID)
				Bot("sendMessage",{"chat_id":chatID,"text":f"✅꒐ تم تحديد المجموعه لاستلام الاشعارات \n{title} {chatID}","reply_to_message_id":message.message_id,"parse_mode":"html"})
		if re.search("^اضف امر عام (.*)$",text):
			cc = re.findall("^اضف امر عام (.*)$",text)
			redis.hset("{}Nbot:stepSUDO:or".format(BOT_ID),userID,cc[0])
			message.reply_text(f"⏺꒐ الان ارسل الامر ليتم تغيره الى {cc[0]}")
		if re.search("^الاوامر العامه$",text):
			tx = "الاوامر العامه ℹ️:\n"
			x = redis.smembers("{}Nbot:{}:TXPoeders".format(BOT_ID,chatID))
			if not x :
				message.reply_text(r.listempty2)
				return 0
			i = 1
			for x in x:
				x = x.split("=")
				tx = tx+f"{i} - {x[0]} > {x[1]}\n"
				i +=1
			kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.delList.format(text), callback_data=json.dumps(["delList","TXPoeders",userID]))]])
			message.reply_text(tx,reply_markup=kb)
			
		if re.search("^مسح الامر العام (.*)$",text):
			cc = re.findall("^مسح الامر العام (.*)$",text)[0]
			x = redis.smembers("{}Nbot:{}:TXPoeders".format(BOT_ID,chatID))
			for x1 in x:
				x = x1.split("=")
				if x[0] == cc:
					redis.srem("{}Nbot:{}:TXPoeders".format(BOT_ID,chatID),x1)
					message.reply_text(f"✅꒐ تم حذف الامر {cc} من الاوامر العامه")
					return 0
			message.reply_text(f"⚠️꒐ لا يوجد {cc} امر")
		if re.search(c.leaveChatS, text) and redis.get("{}Nbot:leaveaddbot".format(BOT_ID)) :
			Bot("leaveChat",{"chat_id":chatID})
			redis.srem("{}Nbot:groups".format(BOT_ID),chatID)
			redis.sadd("{}Nbot:disabledgroups".format(BOT_ID),chatID)
			NextDay_Date = datetime.datetime.today() + datetime.timedelta(days=1)
			redis.hset("{}Nbot:disabledgroupsTIME".format(BOT_ID),chatID,str(NextDay_Date))
		text = text.replace("مسح ","")
		if re.search(c.malk, text) and Ckuser(message):
			arrays = redis.get("{}Nbot:{}:malk".format(BOT_ID,chatID))
			if arrays:
				b = BYusers({arrays},chatID,redis,client)
				if	b is not "":
					Bot("sendMessage",{"chat_id":chatID,"text":r.showlist.format(text,b),"reply_to_message_id":message.message_id,"parse_mode":"markdown"})
				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.listempty.format(text),"reply_to_message_id":message.message_id,"parse_mode":"markdown"})
			else:
				Bot("sendMessage",{"chat_id":chatID,"text":r.listempty.format(text),"reply_to_message_id":message.message_id,"parse_mode":"markdown"})

		if re.search(c.setmalk, text) and Ckuser(message):
			if re.search("@",text):
				user = text.split("@")[1]
			if re.search(c.setmalk2,text):
				user = text.split(" ")[2]
			if message.reply_to_message:
				user = message.reply_to_message.from_user.id
			if 'user' not in locals():return False
			try:
				getUser = client.get_users(user)
				userId = getUser.id
				userFn = getUser.first_name
				setcr = setrank(redis,"malk",userId,chatID,"one")
				if setcr is "malk":
					send_msg("UD",client, message,r.DsetRK,"",getUser,redis)
				elif (setcr is True or setcr is 1):
					send_msg("UD",client, message,r.setRK,"",getUser,redis)
			except Exception as e:
				Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if re.search(c.remmalk, text) and Ckuser(message):
			if re.search("@",text):
				user = text.split("@")[1]
			if re.search(c.remmalk2,text):
				user = text.split(" ")[2]
			if message.reply_to_message:
				user = message.reply_to_message.from_user.id
			if 'user' not in locals():return False
			try:
				getUser = client.get_users(user)
				userId = getUser.id
				userFn = getUser.first_name
				setcr = remrank(redis,"malk",userId,chatID,"one")
				if setcr:
					send_msg("UD",client, message,r.remRK,"",getUser,redis)
				elif not setcr:
					send_msg("UD",client, message,r.DremRK,"",getUser,redis)
			except Exception as e:
				Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})


	if text and (type is "private" or (type is "supergroup" or type is "group")) :
		if rank == "sudo":

			if text == "تفعيل الاذاعه" :
				R = text.split(" ")[1]
				get = redis.get("{}Nbot:bodas".format(BOT_ID))
				BY = "<a href=\"tg://user?id={}\">{}</a>".format(userID,userFN)
				if get :
					save = redis.delete("{}Nbot:bodas".format(BOT_ID))
					Bot("sendMessage",{"chat_id":chatID,"text":r.ADD.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})

				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.ADDed.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})

			if text == "تعطيل الاذاعه" :
				R = text.split(" ")[1]
				BY = "<a href=\"tg://user?id={}\">{}</a>".format(userID,userFN)
				get = redis.get("{}Nbot:bodas".format(BOT_ID))
				if get :
					Bot("sendMessage",{"chat_id":chatID,"text":r.unADDed.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
				else:
					save = redis.set("{}Nbot:bodas".format(BOT_ID),1)
					Bot("sendMessage",{"chat_id":chatID,"text":r.unADD.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
				


			if re.search("^رفع نسخه احتياطيه$|^رفع نسخة احتياطية$", text):
				msgID = Bot("sendMessage",{"chat_id":chatID,"text":"انتظر قليلاً يتم تحميل الملف ℹ️","reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})["result"]["message_id"]
				fileName = message.reply_to_message.download()
				JsonDate = json.load(open(fileName))
				if int(JsonDate["BOT_ID"]) != int(BOT_ID):
					Bot("editMessageText",{"chat_id":chatID,"text":"عذراً هذه الملف ليس لي ⚠️","message_id":msgID,"disable_web_page_preview":True,"parse_mode":"html"})
					return 0
				co = len(JsonDate["group"])
				Bot("editMessageText",{"chat_id":chatID,"text":f"تم ايجاد {co} مجموعه في الملف ℹ️","message_id":msgID,"disable_web_page_preview":True,"parse_mode":"html"})
				for chatid in JsonDate["group"].keys():
					redis.sadd("{}Nbot:groups".format(BOT_ID),chatid)
					for rk in JsonDate["group"][chatid].keys():
						if rk == "malk":
							setrank(redis,rk,JsonDate["group"][chatid][rk],chatid,"one")
						else:
							for userId in JsonDate["group"][chatid][rk]:
								setrank(redis,rk,userId,chatid,"array")
				Bot("editMessageText",{"chat_id":chatID,"text":f"تم رفع المجموعات ✅","message_id":msgID,"disable_web_page_preview":True,"parse_mode":"html"})


			if re.search("^جلب نسخه احتياطيه$|^جلب نسخة احتياطية$", text):
				JsonSave = defaultdict(list)
				JsonSave["BOT_ID"] = BOT_ID
				JsonSave["group"] = {}
				gps = redis.smembers("{}Nbot:groups".format(BOT_ID))
				for gp in gps:
					JsonSave["group"][gp] = {}
					malk_userid = redis.get("{}Nbot:{}:malk".format(BOT_ID,gp))
					if malk_userid:
						JsonSave["group"][gp]["malk"] = int(malk_userid)
					ranks_ar = {"acreator","creator","owner","admin"}
					for rk in ranks_ar:
						get = redis.smembers(f"{BOT_ID}Nbot:{gp}:{rk}")
						if get:
							JsonSave["group"][gp][rk] = {}
							user_ids = []
							for userid in get:
								user_ids.append(int(userid))
							JsonSave["group"][gp][rk] = user_ids

				with open(f'{userID}.json', 'w') as fp:
					json.dump(JsonSave, fp)
				da = datetime.datetime.now().strftime("%Y-%m-%d")
				message.reply_document(f'{userID}.json',caption=f"عدد المجموعات 💬 : {len(gps)}\nتاريخ النسخه 📆 : {da}\n⎯ ⎯ ⎯ ⎯")
			if text == "حذف مجموعه المطور":
				redis.delete("{}Nbot:sudogp".format(BOT_ID))
				Bot("sendMessage",{"chat_id":chatID,"text":f"✅꒐ تم تحويل الاشعارات الى الخاص","reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search("^تحويل الاساسي$|^تحويل الاساسي @(.*)$|^تحويل الاساسي [0-9]+$", text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search("^تحويل الاساسي [0-9]+$" ,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					setsudo(redis,userId)
					date = open("./config.py").read().replace(f"SUDO = {userID}", f"SUDO = {userId}")
					print(date)
					open("./config.py","w+").write(date)
					Bot("sendMessage",{"chat_id":chatID,"text":f"✅꒐ تم تحويل المطور الاساسي الى {userFn} {userId}","reply_to_message_id":message.message_id,"parse_mode":"html"})
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})


		if re.search(c.STreplyBOT, text):
			tx = text.replace(c.RPreplyBOT,"")
			if redis.hexists("{}Nbot:TXreplys".format(BOT_ID,chatID),tx):
				Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:STreplys".format(BOT_ID,chatID),tx):
				Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:GFreplys".format(BOT_ID,chatID),tx):
				Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:VOreplys".format(BOT_ID,chatID),tx):
				Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			else:
				redis.hset("{}Nbot:stepSUDO".format(BOT_ID),userID,tx)
				kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.MoreInfo, url="t.me/zx_xx")]])
				Bot("sendMessage",{"chat_id":chatID,"text":r.Sendreply % tx,"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})
			


		if re.search(c.DLreplyBOT, text):
			tx = text.replace(c.RPdreplyBOT,"")
			if redis.hexists("{}Nbot:TXreplys".format(BOT_ID,chatID),tx):
				redis.hdel("{}Nbot:TXreplys".format(BOT_ID,chatID),tx)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:STreplys".format(BOT_ID,chatID),tx):
				redis.hdel("{}Nbot:STreplys".format(BOT_ID,chatID),tx)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:GFreplys".format(BOT_ID,chatID),tx):
				redis.hdel("{}Nbot:GFreplys".format(BOT_ID,chatID),tx)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:VOreplys".format(BOT_ID,chatID),tx):
				redis.hdel("{}Nbot:GFreplys".format(BOT_ID,chatID),tx)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			else:
				Bot("sendMessage",{"chat_id":chatID,"text":r.Norp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if re.search(c.ReplylistBOT, text):
			reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STword,callback_data=json.dumps(["showreplylistBOT","",userID])),InlineKeyboardButton(c.STgifs,callback_data=json.dumps(["showGFreplylistBOT","",userID])),],[InlineKeyboardButton(c.STvoice,callback_data=json.dumps(["showVOreplylistBOT","",userID])),InlineKeyboardButton(c.STsticker,callback_data=json.dumps(["showSTreplylistBOT","",userID])),]])
			Bot("sendMessage",{"chat_id":chatID,"text":r.blocklist.format(text,title),"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":reply_markup})

		if rank is "sudo" or rank is "asudo":
			if text == c.remfiles:
				onlyfiles = [f for f in listdir("files") if isfile(join("files", f))]
				array = []
				if not onlyfiles:
					Bot("sendMessage",{"chat_id":chatID,"text":r.NOaddfiles2,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
					return False
				for f in onlyfiles:
					array.append([InlineKeyboardButton(f,callback_data=json.dumps(["delF",f,userID]))])
				array.append([InlineKeyboardButton(c.remallfiles,callback_data=json.dumps(["delFa","",userID]))])
				kb = InlineKeyboardMarkup(array)
				Bot("sendMessage",{"chat_id":chatID,"text":r.dlFiles,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True,"reply_markup":kb})


			if text == c.files:
				onlyfiles = [f for f in listdir("files") if isfile(join("files", f))]
				filesR = redis.smembers("{}Nbot:botfiles".format(BOT_ID))
				array = []
				if not onlyfiles:
					Bot("sendMessage",{"chat_id":chatID,"text":r.NOaddfiles2,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
					return False
				for f in onlyfiles:
					if f in filesR:
						s = r.true
					else:
						s = r.false
					array.append([InlineKeyboardButton(f+" "+s,callback_data=json.dumps(["au",f,userID]))])
				kb = InlineKeyboardMarkup(array)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Files,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True,"reply_markup":kb})

			if text == c.ADDfiles:
				url = "https://raw.githubusercontent.com/TshAkEAb/TshakeV2-files/master/files"
				req = requests.get(url).text
				if not re.search(".py",req):
					Bot("sendMessage",{"chat_id":chatID,"text":r.NOaddfiles,"reply_to_message_id":message.message_id,"disable_web_page_preview":True,"parse_mode":"html"})
					return False

				files = req.split("\n")
				array = []
				for f in files:
					array.append([InlineKeyboardButton(f,callback_data=json.dumps(["dlf",f,userID]))])
				kb = InlineKeyboardMarkup(array)
				Bot("sendMessage",{"chat_id":chatID,"text":r.addFiles,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True,"reply_markup":kb})


			if text == c.Ubot:
				Files_H = ["inline.py","all.py","callback.py","delete.py","edit.py","gpcmd.py","locks.py","msg.py","nf.py","ranks.py","sudo.py"]
				#Files_H = ["gpcmd.py"]
				Files_L = ["arreply.py","arcmd.py"]
				Files_U = ["tg.py","locks.py","rank.py","send.py"]
				Files_B = ["bot.py","setup.py"]
				for fnh in Files_H:
					url = "https://raw.githubusercontent.com/ghost11886/TshakeV2/main/handlers/"+fnh
					out = requests.get(url).text
					f = open("./handlers/"+fnh,"w+")
					f.write(out)
					f.close()
				for fnu in Files_U:
					url = "https://raw.githubusercontent.com/ghost11886/TshakeV2/main/utlis/"+fnu
					out = requests.get(url).text
					f = open("./utlis/"+fnu,"w+")
					f.write(out)
					f.close()
				for fnb in Files_B:
					url = "https://raw.githubusercontent.com/ghost11886/TshakeV2/main/"+fnb
					out = requests.get(url).text
					f = open("./"+fnb,"w+")
					f.write(out)
					f.close()
				for fnu in Files_L:
					url = "https://raw.githubusercontent.com/ghost11886/TshakeV2/main/lang/"+fnu
					out = requests.get(url).text
					f = open("./lang/"+fnu,"w+")
					f.write(out)
					f.close()
					
				Bot("sendMessage",{"chat_id":chatID,"text":r.Wres,"reply_to_message_id":message.message_id,"parse_mode":"html"})
				run(redis,chatID)
				
			if re.search(c.setSudoC, text):
				tx = text.replace(c.RsetSudoC,"")
				v = Bot("sendMessage",{"chat_id":chatID,"text":tx,"reply_to_message_id":message.message_id,"parse_mode":"html"})
				if v["ok"]:
					redis.set("{}Nbot:SHOWsudos".format(BOT_ID),tx)
					Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShow,"reply_to_message_id":message.message_id,"parse_mode":"html"})
				elif v["ok"] == False:
					Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.sudosList, text) and Ckuser(message):
				text = text.replace("مسح ","")
				arrays = redis.smembers("{}Nbot:sudos".format(BOT_ID,chatID))
				b = BYusers(arrays,chatID,redis,client)
				kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.delList.format(text), callback_data=json.dumps(["delList","sudos",userID]))]])
				if	b is not "":
					Bot("sendMessage",{"chat_id":chatID,"text":r.showlist.format(text,b),"reply_to_message_id":message.message_id,"parse_mode":"markdown","reply_markup":kb})
				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.listempty.format(text),"reply_to_message_id":message.message_id,"parse_mode":"markdown"})

			if re.search(c.setsudos, text) and Ckuser(message):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.setsudos2,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					setcr = setsudos(redis,userId)
					if setcr is "sudos":
						send_msg("UD",client, message,r.DsetRK,"",getUser,redis)
					elif (setcr is True or setcr is 1):
						send_msg("UD",client, message,r.setRK,"",getUser,redis)
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.remsudos, text) and Ckuser(message):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.remsudos2,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					setcr = remsudos(redis,userId)
					if setcr:
						send_msg("UD",client, message,r.remRK,"",getUser,redis)
					elif not setcr:
						send_msg("UD",client, message,r.DremRK,"",getUser,redis)
				except Exception as e:
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})
			



			if re.search(c.asudoList, text) and Ckuser(message):
				text = text.replace("مسح ","")
				arrays = redis.smembers("{}Nbot:asudo".format(BOT_ID,chatID))
				b = BYusers(arrays,chatID,redis,client)
				kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.delList.format(text), callback_data=json.dumps(["delList","asudo",userID]))]])
				if	b is not "":
					Bot("sendMessage",{"chat_id":chatID,"text":r.showlist.format(text,b),"reply_to_message_id":message.message_id,"parse_mode":"markdown","reply_markup":kb})
				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.listempty.format(text),"reply_to_message_id":message.message_id,"parse_mode":"markdown"})

			if re.search(c.setasudo, text) and Ckuser(message):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.setasudo2,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					setcr = setasudo(redis,userId)
					if setcr is "sudos":
						send_msg("UD",client, message,r.DsetRK,"",getUser,redis)
					elif (setcr is True or setcr is 1):
						send_msg("UD",client, message,r.setRK,"",getUser,redis)
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.remasudo, text) and Ckuser(message):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.remasudo2,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					setcr = remasudo(redis,userId)
					if setcr:
						send_msg("UD",client, message,r.remRK,"",getUser,redis)
					elif not setcr:
						send_msg("UD",client, message,r.DremRK,"",getUser,redis)
				except Exception as e:
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})
			

			if re.search(c.banall, text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.ban2all,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					BY = "<a href=\"tg://user?id={}\">{}</a>".format(userId,userFn)
					Getrank = isrank(redis,userId,chatID)
					GetGprank = GPranks(userId,chatID)
					if Getrank == "bot":return False
					if Getrank == "sudos" or Getrank == "sudo":
						Bot("sendMessage",{"chat_id":chatID,"text":r.cTsudo,"reply_to_message_id":message.message_id,"parse_mode":"html"})
						return False
					if redis.sismember("{}Nbot:bans".format(BOT_ID),userId):
						Bot("sendMessage",{"chat_id":chatID,"text":r.Dbanall.format(BY),"reply_to_message_id":message.message_id,"parse_mode":"html"})
					else:
						redis.sadd("{}Nbot:bans".format(BOT_ID),userId)
						Bot("sendMessage",{"chat_id":chatID,"text":r.banall.format(BY),"reply_to_message_id":message.message_id,"parse_mode":"html"})
						if (GetGprank == "member" or GetGprank == "restricted"):
							Bot("kickChatMember",{"chat_id":chatID,"user_id":userId})
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.unbanall, text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.unban2all,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					Getrank = isrank(redis,userId,chatID)
					GetGprank = GPranks(userId,chatID)
					if Getrank == "bot":return False
					if redis.sismember("{}Nbot:bans".format(BOT_ID),userId):
						redis.srem("{}Nbot:bans".format(BOT_ID),userId)
						send_msg("BNN",client, message,r.unbanall,"bans",getUser,redis)
					else:
						send_msg("BNN",client, message,r.Dunbanall,"bans",getUser,redis)
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.TKall, text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.TK2all,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					Getrank = isrank(redis,userId,chatID)
					GetGprank = GPranks(userId,chatID)
					if Getrank == "bot":return False
					if Getrank == "sudos" or Getrank == "sudo":
						Bot("sendMessage",{"chat_id":chatID,"text":r.cTsudo,"reply_to_message_id":message.message_id,"parse_mode":"html"})
						return False
					if redis.sismember("{}Nbot:restricteds".format(BOT_ID),userId):
						send_msg("BNN",client, message,r.Drestrictedall,"restricteds",getUser,redis)
					else:
						send_msg("BNN",client, message,r.restrictedall,"restricteds",getUser,redis)
						redis.sadd("{}Nbot:restricteds".format(BOT_ID),userId)
						if (GetGprank == "member"):
							Bot("restrictChatMember",{"chat_id": chatID,"user_id": userId,"can_send_messages": 0,"can_send_media_messages": 0,"can_send_other_messages": 0,
						    "can_send_polls": 0,"can_change_info": 0,"can_add_web_page_previews": 0,"can_pin_messages": 0,"can_invite_users": 0,})
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.unTKall, text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.unTK2all,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					Getrank = isrank(redis,userId,chatID)
					GetGprank = GPranks(userId,chatID)
					if Getrank == "bot":return False
					if redis.sismember("{}Nbot:restricteds".format(BOT_ID),userId):
						send_msg("BNN",client, message,r.unrestrictedall,"restricteds",getUser,redis)
						redis.srem("{}Nbot:restricteds".format(BOT_ID),userId)
					else:
						send_msg("BNN",client, message,r.Dunrestrictedall,"restricteds",getUser,redis)
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.Alllist, text) and Ckuser(message):
				reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STbanall,callback_data=json.dumps(["showbanall","",userID])),InlineKeyboardButton(c.STtkall,callback_data=json.dumps(["showtkall","",userID])),]])
				Bot("sendMessage",{"chat_id":chatID,"text":r.banlist,"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":reply_markup})
			
			
			if re.search(c.stats, text) and Ckuser(message):
				pr = redis.scard("{}Nbot:privates".format(BOT_ID))
				gp = redis.scard("{}Nbot:groups".format(BOT_ID))
				kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.CKgps,callback_data=json.dumps(["ckGPs","",userID]))]])
				Bot("sendMessage",{"chat_id":chatID,"text":r.showstats.format(gp,pr),"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})
			
			if re.search(c.fwdall, text) and message.reply_to_message:
				Bot("forwardMessage",{"chat_id":chatID,"from_chat_id":chatID,"message_id":message.reply_to_message.message_id})
				reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["fwdtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["fwdtoprivates","",userID])),]])
				Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})

			if re.search(c.showGPS, text) and Ckuser(message):
				IDS = redis.smembers("{}Nbot:groups".format(BOT_ID))
				GPslist = ""
				i = 1
				for ID in IDS:
					get = Bot("getChat",{"chat_id":ID})
					if get["ok"]:
						Title = (get["result"]["title"] or "None")
						Link = (redis.hget("{}Nbot:links".format(BOT_ID),ID) or GetLink(ID) or "none")
						name = "[{}]({})".format(Title,Link)
						N = r.ShowGPN.format(i,name,ID)
						GPslist = GPslist+"\n\n"+N
						i +=1
				sendM("NO",GPslist,message)
			if text == c.Laudo :
				R = text.split(" ")[1]
				get = redis.get("{}Nbot:autoaddbot".format(BOT_ID))
				BY = "<a href=\"tg://user?id={}\">{}</a>".format(userID,userFN)
				if get :
					Bot("sendMessage",{"chat_id":chatID,"text":r.ADDed.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
				else:
					save = redis.set("{}Nbot:autoaddbot".format(BOT_ID),1)
					Bot("sendMessage",{"chat_id":chatID,"text":r.ADD.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})

			if text == c.Uauto :
				R = text.split(" ")[1]
				BY = "<a href=\"tg://user?id={}\">{}</a>".format(userID,userFN)
				get = redis.get("{}Nbot:autoaddbot".format(BOT_ID))
				if get :
					save = redis.delete("{}Nbot:autoaddbot".format(BOT_ID))
					Bot("sendMessage",{"chat_id":chatID,"text":r.unADD.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.unADDed.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
			
			if text == c.Lleave :
				R = text.split(" ")[1]
				get = redis.get("{}Nbot:leaveaddbot".format(BOT_ID))
				BY = "<a href=\"tg://user?id={}\">{}</a>".format(userID,userFN)
				if get :
					Bot("sendMessage",{"chat_id":chatID,"text":r.ADDed.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
				else:
					save = redis.set("{}Nbot:leaveaddbot".format(BOT_ID),1)
					Bot("sendMessage",{"chat_id":chatID,"text":r.ADD.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})

			if text == c.Uleave :
				R = text.split(" ")[1]
				BY = "<a href=\"tg://user?id={}\">{}</a>".format(userID,userFN)
				get = redis.get("{}Nbot:leaveaddbot".format(BOT_ID))
				if get :
					save = redis.delete("{}Nbot:leaveaddbot".format(BOT_ID))
					Bot("sendMessage",{"chat_id":chatID,"text":r.unADD.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.unADDed.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
			
			if re.search(c.Setauto, text):
				N = text.split(" ")[2]
				redis.set("{}Nbot:autoaddbotN".format(BOT_ID),int(N))
				Bot("sendMessage",{"chat_id":chatID,"text":r.SetAuto.format(N),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
			if re.search(c.leaveChat,text):
				ch = text.split(" ")[1]
				Bot("leaveChat",{"chat_id":ch})
				redis.srem("{}Nbot:groups".format(BOT_ID),ch)
				redis.sadd("{}Nbot:disabledgroups".format(BOT_ID),ch)
				NextDay_Date = datetime.datetime.today() + datetime.timedelta(days=1)
				redis.hset("{}Nbot:disabledgroupsTIME".format(BOT_ID),ch,str(NextDay_Date))
				Bot("sendMessage",{"chat_id":chatID,"text":r.DoneleaveChat,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})




			if re.search(c.sendall, text) and message.reply_to_message and Ckuser(message):
				if rank == "asudo" and redis.get("{}Nbot:bodas".format(BOT_ID)):
					return 0
				if message.reply_to_message.text:
					v = Bot("sendMessage",{"chat_id":chatID,"text":message.reply_to_message.text,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.photo:
					ID = message.reply_to_message.photo.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendphoto",{"chat_id":chatID,"photo":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.voice:
					ID = message.reply_to_message.voice.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendvoice",{"chat_id":chatID,"voice":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.audio:
					ID = message.reply_to_message.audio.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendaudio",{"chat_id":chatID,"audio":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.document:
					ID = message.reply_to_message.document.file_id
					CP = message.reply_to_message.caption
					v = Bot("senddocument",{"chat_id":chatID,"document":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})



				if message.reply_to_message.sticker:
					ID = message.reply_to_message.sticker.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendsticker",{"chat_id":chatID,"sticker":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.animation:
					ID = message.reply_to_message.animation.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendanimation",{"chat_id":chatID,"animation":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.video:
					ID = message.reply_to_message.video.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendvideo",{"chat_id":chatID,"video":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.video_note:
					ID = message.reply_to_message.video_note.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendVideoNote",{"chat_id":chatID,"video_note":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
Esempio n. 3
0
def gpcmd(client, message,redis):
  type = message.chat.type
  userID = message.from_user.id
  chatID = message.chat.id
  title = message.chat.title
  rank = isrank(redis,userID,chatID)
  text = message.text
  username = message.from_user.username
  if username is None:
    username = "******"
  lang = Glang(redis,chatID)
  moduleCMD = "lang."+lang+"-cmd"
  moduleREPLY = "lang."+lang+"-reply"
  c = importlib.import_module(moduleCMD)
  r = importlib.import_module(moduleREPLY)
  #steps
  if redis.hexists("{}Nbot:step".format(BOT_ID),userID):
    tx = redis.hget("{}Nbot:step".format(BOT_ID),userID)
    if text :
      redis.hset("{}Nbot:{}:TXreplys".format(BOT_ID,chatID),tx,text)
      redis.hdel("{}Nbot:step".format(BOT_ID),userID)
      Bot("sendMessage",{"chat_id":chatID,"text":r.SRtext.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
    
    if message.sticker:
      ID = message.sticker.file_id
      redis.hset("{}Nbot:{}:STreplys".format(BOT_ID,chatID),tx,ID)
      redis.hdel("{}Nbot:step".format(BOT_ID),userID)
      Bot("sendMessage",{"chat_id":chatID,"text":r.SRst.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

    if message.animation:
      ID = message.animation.file_id
      redis.hset("{}Nbot:{}:GFreplys".format(BOT_ID,chatID),tx,ID)
      redis.hdel("{}Nbot:step".format(BOT_ID),userID)
      Bot("sendMessage",{"chat_id":chatID,"text":r.SRgf.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

    if message.voice:
      ID = message.voice.file_id
      redis.hset("{}Nbot:{}:VOreplys".format(BOT_ID,chatID),tx,ID)
      redis.hdel("{}Nbot:step".format(BOT_ID),userID)
      Bot("sendMessage",{"chat_id":chatID,"text":r.SRvo.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
    
    if message.photo:
      ID = message.photo.file_id
      redis.hset("{}Nbot:{}:PHreplys".format(BOT_ID,chatID),tx,ID)
      redis.hdel("{}Nbot:step".format(BOT_ID),userID)
      Bot("sendMessage",{"chat_id":chatID,"text":r.SRph.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
    if message.document:
      ID = message.document.file_id
      redis.hset("{}Nbot:{}:DOreplys".format(BOT_ID,chatID),tx,ID)
      redis.hdel("{}Nbot:step".format(BOT_ID),userID)
      Bot("sendMessage",{"chat_id":chatID,"text":r.SRfi.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})



###############
  if text:
    if text == c.delrpmsg and message.reply_to_message:
      Bot("deleteMessage",{"chat_id":chatID,"message_id":message.message_id})
      Bot("deleteMessage",{"chat_id":chatID,"message_id":message.reply_to_message.message_id})

    if text == c.settingsCmd and Ckuser(message):
      kb = st(client, message,redis)
      Bot("sendMessage",{"chat_id":chatID,"text":r.settings.format(title),"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})


    if re.search(c.settingsCmdRes, text) and Ckuser(message):
      kb = st_res(client, message,redis)
      Bot("sendMessage",{"chat_id":chatID,"text":r.settingsRes.format(title),"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})
    
    
    if re.search(c.bans, text):
      arrays = redis.smembers("{}Nbot:{}:bans".format(BOT_ID,chatID))
      b = BYusers(arrays,chatID,redis,client)
      kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.delList.format(text), callback_data=json.dumps(["delListbans","",userID]))]])
      if  b is not "":
        Bot("sendMessage",{"chat_id":chatID,"text":r.showlist.format(text,b),"reply_to_message_id":message.message_id,"parse_mode":"markdown","reply_markup":kb})
      else:
        Bot("sendMessage",{"chat_id":chatID,"text":r.listempty.format(text),"reply_to_message_id":message.message_id,"parse_mode":"markdown"})

    if re.search(c.restricteds, text):
      arrays = redis.smembers("{}Nbot:{}:restricteds".format(BOT_ID,chatID))
      b = BYusers(arrays,chatID,redis,client)
      kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.delList.format(text), callback_data=json.dumps(["delListrestricteds","",userID]))]])
      if  b is not "":
        Bot("sendMessage",{"chat_id":chatID,"text":r.showlist.format(text,b),"reply_to_message_id":message.message_id,"parse_mode":"markdown","reply_markup":kb})
      else:
        Bot("sendMessage",{"chat_id":chatID,"text":r.listempty.format(text),"reply_to_message_id":message.message_id,"parse_mode":"markdown"})

    orban = redis.hget("{}Nbot:banor:cb".format(BOT_ID),chatID) or c.ban
    orban2 = redis.hget("{}Nbot:banor:cb2".format(BOT_ID),chatID) or c.ban2
    if re.search(c.ban+"|"+orban, text):
      if re.search("@",text):
        user = text.split("@")[1]
      if re.search(c.ban2+"|"+orban2,text):
        user = int(re.search(r'\d+', text).group())
      if message.reply_to_message:
        user = message.reply_to_message.from_user.id
      if 'user' not in locals():return False
      try:
        getUser = client.get_users(user)
        #print(getUser)
        userId = getUser.id
        userFn = getUser.first_name
        Getrank = isrank(redis,userId,chatID)
        GetGprank = GPranks(userId,chatID)
        if Getrank == "bot":return False
        if GetGprank == "NoMember":
          Bot("sendMessage",{"chat_id":chatID,"text":r.NoMember,"reply_to_message_id":message.message_id,"parse_mode":"html"})
        if (GetGprank == "left" or GetGprank == "kicked"):
          Bot("sendMessage",{"chat_id":chatID,"text":r.haveKick,"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif (GetGprank == "member" or GetGprank == "restricted") and (Getrank is False or Getrank is 0):
          if redis.sismember("{}Nbot:{}:bans".format(BOT_ID,chatID),userId):
            send_msg("BNN",client, message,r.Dban,"bans",getUser,redis)
          else:
            Bot("kickChatMember",{"chat_id":chatID,"user_id":userId})
            redis.sadd("{}Nbot:{}:bans".format(BOT_ID,chatID),userId)
            send_msg("BN",client, message,r.ban,"bans",getUser,redis)
        elif (GetGprank == "creator" or GetGprank == "administrator") or (Getrank != False or Getrank != 0):
          Bot("sendMessage",{"chat_id":chatID,"text":r.haveRank.format(Grank((Getrank or GetGprank),r)),"reply_to_message_id":message.message_id,"parse_mode":"html"})
      except Exception as e:
        Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

    if re.search(c.unban, text):
      if re.search("@",text):
        user = text.split("@")[1]
      if re.search(c.unban2,text):
        user = text.split(" ")[1]
      if message.reply_to_message:
        user = message.reply_to_message.from_user.id
      if 'user' not in locals():return False
      try:
        getUser = client.get_users(user)
        userId = getUser.id
        userFn = getUser.first_name
        Getrank = isrank(redis,userId,chatID)
        GetGprank = GPranks(userId,chatID)
        if Getrank == "bot":return False
        if GetGprank == "NoMember":
          Bot("sendMessage",{"chat_id":chatID,"text":r.NoMember,"reply_to_message_id":message.message_id,"parse_mode":"html"})
          return False
        if GetGprank == "kicked":
          Bot("unbanChatMember",{"chat_id":chatID,"user_id":userId})
          redis.srem("{}Nbot:{}:bans".format(BOT_ID,chatID),userId)
          send_msg("BN",client, message,r.unban,"bans",getUser,redis)
        else:
          send_msg("BNN",client, message,r.Dunban,"bans",getUser,redis)
      except Exception as e:
        Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})
   
    ortk = redis.hget("{}Nbot:tkor:cb".format(BOT_ID),chatID) or c.TK
    ortk2 = redis.hget("{}Nbot:tkor:cb2".format(BOT_ID),chatID) or c.TK2
    if re.search(c.TK+"|"+ortk, text):
      if re.search("@",text):
        user = text.split("@")[1]
      if re.search(c.TK2+"|"+ortk2,text):
        user = int(re.search(r'\d+', text).group())
      if message.reply_to_message:
        user = message.reply_to_message.from_user.id
      if 'user' not in locals():return False
      try:
        getUser = client.get_users(user)
        userId = getUser.id
        userFn = getUser.first_name
        Getrank = isrank(redis,userId,chatID)
        GetGprank = GPranks(userId,chatID)
        if Getrank == "bot":return False
        if GetGprank == "NoMember":
          Bot("sendMessage",{"chat_id":chatID,"text":r.NoMember,"reply_to_message_id":message.message_id,"parse_mode":"html"})
        if (GetGprank == "left" or GetGprank == "kicked"):
          Bot("sendMessage",{"chat_id":chatID,"text":r.haveKick,"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif (GetGprank == "restricted"):
          send_msg("BNN",client, message,r.haveRc,"restricteds",getUser,redis)
          #Bot("sendMessage",{"chat_id":chatID,"text":r.haveRc,"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif GetGprank == "member" and (Getrank is False or Getrank is 0):
          if redis.sismember("{}Nbot:{}:restricteds".format(BOT_ID,chatID),userId):
            send_msg("BNN",client, message,r.Drestricted,"restricteds",getUser,redis)
          else:
            Bot("restrictChatMember",{"chat_id": chatID,"user_id": userId,"can_send_messages": 0,"can_send_media_messages": 0,"can_send_other_messages": 0,
            "can_send_polls": 0,"can_change_info": 0,"can_add_web_page_previews": 0,"can_pin_messages": 0,"can_invite_users": 0,})
            redis.sadd("{}Nbot:{}:restricteds".format(BOT_ID,chatID),userId)
            send_msg("BN",client, message,r.restricted,"restricteds",getUser,redis)
        elif (GetGprank == "creator" or GetGprank == "administrator") or (Getrank != False or Getrank != 0):
          Bot("sendMessage",{"chat_id":chatID,"text":r.haveRank.format(Grank((Getrank or GetGprank),r)),"reply_to_message_id":message.message_id,"parse_mode":"html"})
      except Exception as e:
        Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

    if re.search(c.unTK, text):
      if re.search("@",text):
        user = text.split("@")[1]
      if re.search(c.unTK2,text):
        user = text.split(" ")[1]
      if message.reply_to_message:
        user = message.reply_to_message.from_user.id
      if 'user' not in locals():return False
      try:
        getUser = client.get_users(user)
        userId = getUser.id
        userFn = getUser.first_name
        Getrank = isrank(redis,userId,chatID)
        GetGprank = GPranks(userId,chatID)
        if Getrank == "bot":return False
        if GetGprank == "NoMember":
          Bot("sendMessage",{"chat_id":chatID,"text":r.NoMember,"reply_to_message_id":message.message_id,"parse_mode":"html"})
          return False
        if GetGprank == "restricted":
          Bot("restrictChatMember",{"chat_id": chatID,"user_id": userId,"can_send_messages": 1,"can_send_media_messages": 1,"can_send_other_messages": 1,"can_send_polls": 1,
          "can_change_info": 1,"can_add_web_page_previews": 1,"can_pin_messages": 1,"can_invite_users": 1,})
          redis.srem("{}Nbot:{}:restricteds".format(BOT_ID,chatID),userId)
          send_msg("BN",client, message,r.unrestricted,"restricteds",getUser,redis)
        else:
          send_msg("BNN",client, message,r.Dunrestricted,"restricteds",getUser,redis)
      except Exception as e:
        Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})
    
    if rank != "admin":
      if re.search(c.addor,text):
        cc= re.findall(c.addor,text)
        kbList = {"vip":{
          "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
          "cb2":"^{0}{0-9}+$",
          "rp":c.orvip,
        },"admin":{
          "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
          "cb2":"^{0}{0-9}+$",
          "rp":c.orad,
        },"ban":{
          "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
          "cb2":"^{0}{0-9}+$",
          "rp":c.orban,
        },"tk":{
          "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
          "cb2":"^{0}{0-9}+$",
          "rp":c.ortk,
        }
        }
        if rank == "sudo":
          kbList = {"vip":{
            "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
            "cb2":"^{0}{0-9}+$",
            "rp":c.orvip,
          },"owner":{
            "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
            "cb2":"^{0}{0-9}+$",
            "rp":c.orow,
          },"admin":{
            "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
            "cb2":"^{0}{0-9}+$",
            "rp":c.orad,
          },"ban":{
            "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
            "cb2":"^{0}{0-9}+$",
            "rp":c.orban,
          },"tk":{
            "cb":"^{0}$|^{0} @(.*)$|{0} {0-9}+$",
            "cb2":"^{0}{0-9}+$",
            "rp":c.ortk,
          }
          } 
        il = []
        for key, value in kbList.items():
          cb = json.dumps(["addor",key,userID])
          rp = value["rp"]
          il.append([InlineKeyboardButton(rp,callback_data=cb)])
        kb = InlineKeyboardMarkup(il)
        message.reply_text(r.addor.format(cc[0]),reply_markup=kb)

      if re.search(c.remallR, text):
        if re.search("@",text):
          user = text.split("@")[1]
        if re.search(c.remallR2,text):
          user = text.split(" ")[1]
        if message.reply_to_message:
          user = message.reply_to_message.from_user.id
        if 'user' not in locals():return False
        try:
          getUser = client.get_users(user)
          userId = getUser.id
          userFn = getUser.first_name
          Rank = isrank(redis,userId,chatID)
          tx = ""
          if (Rank is False or Rank is 0):
            BY = "<a href=\"tg://user?id={}\">{}</a>".format(userId,userFn)
            Bot("sendMessage",{"chat_id":chatID,"text":r.remallN.format(BY),"reply_to_message_id":message.message_id,"parse_mode":"html"})
            
          if rank == "sudo":
            if isrank(redis,userId,chatID) == "sudos":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remsudos(redis,userId)

            if isrank(redis,userId,chatID) == "creator":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"creator",userId,chatID,"one")

            if isrank(redis,userId,chatID) == "owner":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"owner",userId,chatID,"array")

            if isrank(redis,userId,chatID) == "admin":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"admin",userId,chatID,"array")
            if isrank(redis,userId,chatID) == "vip":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"vip",userId,chatID,"array")
            
          if rank == "sudos":

            if isrank(redis,userId,chatID) == "creator":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"creator",userId,chatID,"one")

            if isrank(redis,userId,chatID) == "owner":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"owner",userId,chatID,"array")

            if isrank(redis,userId,chatID) == "admin":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"admin",userId,chatID,"array")
            if isrank(redis,userId,chatID) == "vip":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"vip",userId,chatID,"array")
            
          if rank == "creator":
            if isrank(redis,userId,chatID) == "owner":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"owner",userId,chatID,"array")
            if isrank(redis,userId,chatID) == "admin":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"admin",userId,chatID,"array")
            if isrank(redis,userId,chatID) == "vip":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"vip",userId,chatID,"array")
            
          if rank == "owner":
            if isrank(redis,userId,chatID) == "admin":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"admin",userId,chatID,"array")
            if isrank(redis,userId,chatID) == "vip":
              t = IDrank(redis,userId,chatID,r)
              tx = tx+t+","
              remrank(redis,"vip",userId,chatID,"array")


          if (rank == "owner" or rank == "creator" or rank == "sudos" or rank == "sudo") and (Rank != False or Rank != 0):
            BY = "<a href=\"tg://user?id={}\">{}</a>".format(userId,userFn)
            Bot("sendMessage",{"chat_id":chatID,"text":r.remall.format(BY,tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})



        except Exception as e:
          Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})
      if re.search(c.floodset, text):
        if redis.hexists("{}Nbot:floodset".format(BOT_ID),chatID):
          get = redis.hget("{}Nbot:floodset".format(BOT_ID),chatID)
        else:
          get = "res"
        if get == "ban":
          tx = r.Tban
        if get == "res":
          tx =  r.Tres
        kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.fset.format(tx),callback_data=json.dumps(["floodset",get,userID]))]])
        Bot("sendMessage",{"chat_id":chatID,"text":r.Tfset,"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})

      if re.search(c.twostepset, text):
        if redis.hexists("{}Nbot:bancheck:t".format(BOT_ID),chatID):
          get = redis.hget("{}Nbot:bancheck:t".format(BOT_ID),chatID)
        else:
          get = "eq"
        if get == "eq":
          tx = r.Teq
        if get == "two":
          tx =  r.Ttwo
        kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.tset.format(tx),callback_data=json.dumps(["twostepset",get,userID]))]])
        Bot("sendMessage",{"chat_id":chatID,"text":r.Ttset,"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})

      if re.search(c.delIDC, text):
        redis.hdel("{}Nbot:SHOWid".format(BOT_ID),chatID)
        Bot("sendMessage",{"chat_id":chatID,"text":r.Ddelid,"reply_to_message_id":message.message_id,"parse_mode":"html"})
      if re.search("^تعين ايدي$|^تعين ايدي (.*)$|^وضع ايدي$|^وضع ايدي (.*)$",text):
        message.reply_text("""⚠️꒐ يمكنك تغير الايدي بأرسال
⏺꒐ `تعين الايدي النص`

🔽꒐ ويمكنك ايضاً اضافه
{id} - لعرض الايدي
{us} - لعرض المعرف
{rk} - لعرض الرتبه
{msgs} - لعرض عدد الرسائل
{edits} - لعرض عدد السحكات
{rate} - لعرض نسبه التفاعل
⎯ ⎯ ⎯ ⎯""")
      if re.search("^اضف رد$",text):
        message.reply_text(  
"""⚠️꒐ يمكنك اضف رد  بأرسال
⏺꒐ `اضف رد النص`

🔽꒐ ويمكنك ايضاً اضافه html

<b>bold</b>
*bold*

<i>italic</i>
__italic__

<a href=\"https://t.me/mdddd/\">Mohammed</a>
[Mohammed](https://t.me/mdddd/)

<code>inline fixed-width code</code>
`inline fixed-width code`
⎯ ⎯ ⎯ ⎯""",parse_mode="markdown",disable_web_page_preview=True)
      if re.search(c.setIDC, text):
          tx = text.replace(c.RsetIDC,"")
          t = IDrank(redis,userID,chatID,r)
          msgs = (redis.hget("{}Nbot:{}:msgs".format(BOT_ID,chatID),userID) or 0)
          edits = (redis.hget("{}Nbot:{}:edits".format(BOT_ID,chatID),userID) or 0)
          rate = int(msgs)*100/20000
          age = getAge(userID,r)
          v = Bot("sendMessage",{"chat_id":chatID,"text":tx.format(us=("@"+username or "None"),id=userID,rk=t,msgs=msgs,edits=edits,age=age,rate=str(rate)+"%"),"reply_to_message_id":message.message_id,"parse_mode":"html"})
          if v["ok"]:
            redis.hset("{}Nbot:SHOWid".format(BOT_ID),chatID,tx)
            Bot("sendMessage",{"chat_id":chatID,"text":r.DsetIDShow,"reply_to_message_id":message.message_id,"parse_mode":"html"})
          elif v["ok"] == False:
            Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.message_id,"parse_mode":"html"})

      if re.search(c.block, text):
        if re.search(c.block2, text):
          tx = text.replace(c.RPbk,"")
          if redis.sismember("{}Nbot:{}:blockTEXTs".format(BOT_ID,chatID),tx):
            Bot("sendMessage",{"chat_id":chatID,"text":r.Adoneblock.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
          else:
            redis.sadd("{}Nbot:{}:blockTEXTs".format(BOT_ID,chatID),tx)
            Bot("sendMessage",{"chat_id":chatID,"text":r.Doneblock.format(tx,title),"reply_to_message_id":message.message_id,"parse_mode":"html"})

        if message.reply_to_message:
          if message.reply_to_message.sticker:
            ID = message.reply_to_message.sticker.file_id
            if redis.sismember("{}Nbot:{}:blockSTICKERs".format(BOT_ID,chatID),ID):
              Bot("sendMessage",{"chat_id":chatID,"text":r.StA.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
            else:
              redis.sadd("{}Nbot:{}:blockSTICKERs".format(BOT_ID,chatID),ID)
              Bot("sendMessage",{"chat_id":chatID,"text":r.StB.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
          
          if message.reply_to_message.photo:
            ID = message.reply_to_message.photo.file_id
            if redis.sismember("{}Nbot:{}:blockphotos".format(BOT_ID,chatID),ID):
              Bot("sendMessage",{"chat_id":chatID,"text":r.PhA.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
            else:
              redis.sadd("{}Nbot:{}:blockphotos".format(BOT_ID,chatID),ID)
              Bot("sendMessage",{"chat_id":chatID,"text":r.PhB.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
          
          if message.reply_to_message.animation:
            ID = message.reply_to_message.animation.file_id
            if redis.sismember("{}Nbot:{}:blockanimations".format(BOT_ID,chatID),ID):
              Bot("sendMessage",{"chat_id":chatID,"text":r.GfA.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
            else:
              redis.sadd("{}Nbot:{}:blockanimations".format(BOT_ID,chatID),ID)
              Bot("sendMessage",{"chat_id":chatID,"text":r.GfB.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

      if re.search(c.unblock, text):
        if re.search(c.unblock2, text):
          tx = text.replace(c.RPubk,"")
          if redis.sismember("{}Nbot:{}:blockTEXTs".format(BOT_ID,chatID),tx):
            redis.srem("{}Nbot:{}:blockTEXTs".format(BOT_ID,chatID),tx)
            Bot("sendMessage",{"chat_id":chatID,"text":r.unDoneblock.format(tx,title),"reply_to_message_id":message.message_id,"parse_mode":"html"})
          else:
            Bot("sendMessage",{"chat_id":chatID,"text":r.unAdoneblock.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

        if message.reply_to_message:
          if message.reply_to_message.sticker:
            ID = message.reply_to_message.sticker.file_id
            if redis.sismember("{}Nbot:{}:blockSTICKERs".format(BOT_ID,chatID),ID):
              redis.srem("{}Nbot:{}:blockSTICKERs".format(BOT_ID,chatID),ID)
              Bot("sendMessage",{"chat_id":chatID,"text":r.unStB.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
            else:
              Bot("sendMessage",{"chat_id":chatID,"text":r.unStA.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

          if message.reply_to_message.photo:
            ID = message.reply_to_message.photo.file_id
            if redis.sismember("{}Nbot:{}:blockphotos".format(BOT_ID,chatID),ID):
              redis.srem("{}Nbot:{}:blockphotos".format(BOT_ID,chatID),ID)
              Bot("sendMessage",{"chat_id":chatID,"text":r.unPhB.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})       
            else:
              Bot("sendMessage",{"chat_id":chatID,"text":r.unPhA.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
          
          if message.reply_to_message.animation:
            ID = message.reply_to_message.animation.file_id
            if redis.sismember("{}Nbot:{}:blockanimations".format(BOT_ID,chatID),ID):
              redis.srem("{}Nbot:{}:blockanimations".format(BOT_ID,chatID),ID)
              Bot("sendMessage",{"chat_id":chatID,"text":r.unGfB.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})
            else:
              Bot("sendMessage",{"chat_id":chatID,"text":r.unGfA.format(title),"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

      if re.search(c.Blocklist, text):
        Botuser = client.get_me().username
        reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STword,url="https://telegram.me/{}?start=showBlocklist={}={}={}".format(Botuser,chatID,userID,"blockTEXTs")),InlineKeyboardButton(c.STgifs,url="https://telegram.me/{}?start=showBlocklist={}={}={}".format(Botuser,chatID,userID,"blockanimations")),],[InlineKeyboardButton(c.STphoto,url="https://telegram.me/{}?start=showBlocklist={}={}={}".format(Botuser,chatID,userID,"blockphotos")),InlineKeyboardButton(c.STsticker,url="https://telegram.me/{}?start=showBlocklist={}={}={}".format(Botuser,chatID,userID,"blockSTICKERs")),]])
        Bot("sendMessage",{"chat_id":chatID,"text":r.blocklist.format(r.blocklist2,title),"reply_to_message_id":message.message_id,"reply_markup":reply_markup})

      if re.search(c.Replylist, text):
        reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STword,callback_data=json.dumps(["showreplylist","",userID])),InlineKeyboardButton(c.STgifs,callback_data=json.dumps(["showGFreplylist","",userID])),],[InlineKeyboardButton(c.STvoice,callback_data=json.dumps(["showVOreplylist","",userID])),InlineKeyboardButton(c.STsticker,callback_data=json.dumps(["showSTreplylist","",userID])),]])
        Bot("sendMessage",{"chat_id":chatID,"text":r.blocklist.format(text,title),"reply_to_message_id":message.message_id,"reply_markup":reply_markup})

      if re.search(c.FloodT, text):
        Nu = text.split(" ")[2]
        redis.hset("{}Nbot:time_ck".format(BOT_ID),chatID,Nu)
        Bot("sendMessage",{"chat_id":chatID,"text":r.DoneSet.format(text.split(" ")[0]+" "+text.split(" ")[1],Nu),"reply_to_message_id":message.message_id,"parse_mode":"html"})

      if re.search(c.FloodM, text):
        Nu = text.split(" ")[2]
        redis.hset("{}Nbot:max_msg".format(BOT_ID),chatID,Nu)
        Bot("sendMessage",{"chat_id":chatID,"text":r.DoneSet.format(text.split(" ")[0]+" "+text.split(" ")[1],Nu),"reply_to_message_id":message.message_id,"parse_mode":"html"})

      if re.search(c.STWEL, text):
        Wc = text.replace(c.RPwel,"")
        redis.hset("{}Nbot:welcome".format(BOT_ID),chatID,Wc)
        Bot("sendMessage",{"chat_id":chatID,"text":r.Donewel.format(Wc),"reply_to_message_id":message.message_id,"parse_mode":"html"})


      if re.search(c.STreply, text):
        tx = text.replace(c.RPreply,"")
        if redis.hexists("{}Nbot:{}:TXreplys".format(BOT_ID,chatID),tx):
          Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif redis.hexists("{}Nbot:{}:STreplys".format(BOT_ID,chatID),tx):
          Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif redis.hexists("{}Nbot:{}:GFreplys".format(BOT_ID,chatID),tx):
          Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif redis.hexists("{}Nbot:{}:VOreplys".format(BOT_ID,chatID),tx):
          Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
        else:
          redis.hset("{}Nbot:step".format(BOT_ID),userID,tx)
          kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.MoreInfo, url="t.me/nbbot")]])
          Bot("sendMessage",{"chat_id":chatID,"text":r.Sendreply % tx,"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})

      if re.search(c.DLreply, text):
        tx = text.replace(c.RPdreply,"")
        if redis.hexists("{}Nbot:{}:TXreplys".format(BOT_ID,chatID),tx):
          redis.hdel("{}Nbot:{}:TXreplys".format(BOT_ID,chatID),tx)
          Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif redis.hexists("{}Nbot:{}:STreplys".format(BOT_ID,chatID),tx):
          redis.hdel("{}Nbot:{}:STreplys".format(BOT_ID,chatID),tx)
          Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif redis.hexists("{}Nbot:{}:GFreplys".format(BOT_ID,chatID),tx):
          redis.hdel("{}Nbot:{}:GFreplys".format(BOT_ID,chatID),tx)
          Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
        elif redis.hexists("{}Nbot:{}:VOreplys".format(BOT_ID,chatID),tx):
          redis.hdel("{}Nbot:{}:GFreplys".format(BOT_ID,chatID),tx)
          Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
        else:
          Bot("sendMessage",{"chat_id":chatID,"text":r.Norp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
    if re.search(c.setname, text):
      name = text.replace(c.Dsetname,"")
      Bot("setChatTitle",{"chat_id":chatID,"title":name})
      Bot("sendMessage",{"chat_id":chatID,"text":r.Dsetname.format(name),"reply_to_message_id":message.message_id,"parse_mode":"html"})

    if re.search(c.setabout, text):
      about = text.replace(c.Dsetabout,"")
      Bot("setChatDescription",{"chat_id":chatID,"description":about})
      Bot("sendMessage",{"chat_id":chatID,"text":r.Dsetabout.format(about),"reply_to_message_id":message.message_id,"parse_mode":"html"})

    if re.search(c.setphoto, text) and message.reply_to_message and message.reply_to_message.photo:
      ID = message.reply_to_message.photo.file_id
      client.set_chat_photo(chat_id=chatID,photo=ID)
      Bot("sendMessage",{"chat_id":chatID,"text":r.Dsetphoto,"reply_to_message_id":message.message_id,"parse_mode":"html"})
    
    if re.search(c.pinmsg, text) and message.reply_to_message:
      if not redis.sismember("{}Nbot:Lpin".format(BOT_ID),chatID):
        ID = message.reply_to_message.message_id
        Bot("pinChatMessage",{"chat_id":chatID,"message_id":ID})
        redis.hset("{}Nbot:pinmsgs".format(BOT_ID),chatID,ID)
        Bot("sendMessage",{"chat_id":chatID,"text":r.Dpinmsg,"reply_to_message_id":message.message_id,"parse_mode":"html"})
      elif redis.sismember("{}Nbot:Lpin".format(BOT_ID),chatID) and rank == "creator":
        ID = message.reply_to_message.message_id
        Bot("pinChatMessage",{"chat_id":chatID,"message_id":ID})
        redis.hset("{}Nbot:pinmsgs".format(BOT_ID),chatID,ID)
        Bot("sendMessage",{"chat_id":chatID,"text":r.Dpinmsg,"reply_to_message_id":message.message_id,"parse_mode":"html"})

      if re.search(c.unpinmsg, text):
        if not redis.sismember("{}Nbot:Lpin".format(BOT_ID),chatID):
          Bot("unpinChatMessage",{"chat_id":chatID,"message_id":ID})
          Bot("sendMessage",{"chat_id":chatID,"text":r.Dunpinmsg,"reply_to_message_id":message.message_id,"parse_mode":"html"})
        if redis.sismember("{}Nbot:Lpin".format(BOT_ID),chatID) and rank == "creator":
          Bot("unpinChatMessage",{"chat_id":chatID,"message_id":ID})
          Bot("sendMessage",{"chat_id":chatID,"text":r.Dunpinmsg,"reply_to_message_id":message.message_id,"parse_mode":"html"})
      
    if re.search(c.SETlink, text):
      lk = text.replace(c.RPlink,"")
      redis.hset("{}Nbot:links".format(BOT_ID),chatID,lk)
      Bot("sendMessage",{"chat_id":chatID,"text":r.Dsetlk.format(lk),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})

#cre
    if rank != "admin" and rank != "owner":
      if re.search(c.deletebots, text):
        bots = [x for x in client.iter_chat_members(chatID,filter="bots") if x.user.is_bot and x.user.id !=int(BOT_ID) and x.status != "administrator"]
        if bots:
          Bot("sendMessage",{"chat_id":chatID,"text":r.LenBots.format(len(bots)),"reply_to_message_id":message.message_id,"parse_mode":"html"})
          for u in bots:
            Bot("kickChatMember",{"chat_id":chatID,"user_id":u.user.id,"until_date":int(time.time() + 60)})
            time.sleep(0.3)
        else:
          Bot("sendMessage",{"chat_id":chatID,"text":r.NoBots,"reply_to_message_id":message.message_id,"parse_mode":"html"})
      
      if re.search(c.deletebans, text):
        kicked = [x for x in client.iter_chat_members(chatID,filter="kicked")]
        if kicked:
          Bot("sendMessage",{"chat_id":chatID,"text":r.Lenbans.format(len(kicked)),"reply_to_message_id":message.message_id,"parse_mode":"html"})
          for u in kicked:
            Bot("unbanChatMember",{"chat_id":chatID,"user_id":u.user.id})
            redis.srem("{}Nbot:{}:bans".format(BOT_ID,chatID),u.user.id)
            time.sleep(0.3)
        else:
          Bot("sendMessage",{"chat_id":chatID,"text":r.NobansC,"reply_to_message_id":message.message_id,"parse_mode":"html"})
      

      if re.search(c.deleterks, text):
        restricted = [x for x in client.iter_chat_members(chatID,filter="restricted")]
        if restricted:
          Bot("sendMessage",{"chat_id":chatID,"text":r.Lenrks.format(len(restricted)),"reply_to_message_id":message.message_id,"parse_mode":"html"})
          for u in restricted:
            Bot("restrictChatMember",{"chat_id": chatID,"user_id": userId,"can_send_messages": 1,"can_send_media_messages": 1,"can_send_other_messages": 1,"can_send_polls": 1,
          "can_change_info": 1,"can_add_web_page_previews": 1,"can_pin_messages": 1,"can_invite_users": 1,})
            redis.srem("{}Nbot:{}:restricteds".format(BOT_ID,chatID),u.user.id)
            time.sleep(0.3)
        else:
          Bot("sendMessage",{"chat_id":chatID,"text":r.NorksC,"reply_to_message_id":message.message_id,"parse_mode":"html"})
        
      if re.search(c.deleteDeleted, text):
        deleted = [x for x in client.iter_chat_members(chatID) if x.user.is_deleted]
        if deleted:
          Bot("sendMessage",{"chat_id":chatID,"text":r.LenDeleted.format(len(deleted)),"reply_to_message_id":message.message_id,"parse_mode":"html"})
          for u in deleted:
            Bot("kickChatMember",{"chat_id":chatID,"user_id":u.user.id,"until_date":int(time.time() + 60)})
            time.sleep(0.3)
        else:
          Bot("sendMessage",{"chat_id":chatID,"text":r.NoDeleted,"reply_to_message_id":message.message_id,"parse_mode":"html"})
      
      if re.search(c.delmsgs, text):
              lim = text.split(" ")[1]
              ids = []
              if message.reply_to_message:
                nu = message.reply_to_message.message_id
                ids.append(message.message_id)
              elif message.message_id:
                nu = message.message_id
              for i in range(int(lim)):
                ids.append(nu-i)
              client.delete_messages(chatID, ids)
              #print(ids)

      if re.search(c.tagall, text):
        tagall = [x for x in client.iter_chat_members(chatID)]
        if tagall:
          listTag = ""
          i = 1
          for u in tagall:
            if u.user.username:
              listTag = listTag+"\n"+str(i)+" - [@{}]".format(u.user.username)
            else:
              listTag = listTag+"\n"+str(i)+" - [{}](tg://user?id={})".format(u.user.first_name,u.user.id)
            i += 1 
          sendM("NO",listTag,message)
          
      if re.search(c.Chlang, text):
        Bot("sendMessage",{"chat_id":chatID,"text":r.Chlang,"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":Clang(client, message,redis,r)})
      if re.search(c.PROadmins, text):
        ads = Bot("getChatAdministrators",{"chat_id":chatID})
        for ad in ads['result']:
          userId = ad["user"]["id"]
          userFn = ad["user"]["first_name"]
          if ad['status'] == "administrator" and int(userId) != int(BOT_ID):
            setrank(redis,"admin",userId,chatID,"array")
        Bot("sendMessage",{"chat_id":chatID,"text":r.DPROadmins,"reply_to_message_id":message.message_id,"parse_mode":"html"})
Esempio n. 4
0
def ranks(client, message, redis):
    type = message.chat.type
    userID = message.from_user.id
    chatID = message.chat.id
    rank = isrank(redis, userID, chatID)
    text = message.text
    c = importlib.import_module("lang.arcmd")
    r = importlib.import_module("lang.arreply")

    if (rank is "sudo" or rank is "asudo" or rank is "sudos"
            or rank is "malk"):
        if re.search("^ترتيب الاوامر$", text):
            ar = {
                "ا": "ايدي",
                "م": "رفع مميز",
                "اد": "رفع ادمن",
                "مد": "رفع مدير",
                "من": "رفع منشى",
                "اس": "رفع منشى اساسي",
                "تعط": "تعطيل الايدي بالصورة",
                "تفع": "تفعيل الايدي بالصورة",
            }
            i = 1
            orders = ""
            for tx, text in ar.items():
                ad = f"{tx}={text}"
                if not redis.sismember(
                        "{}Nbot:{}:TXoeders".format(BOT_ID, chatID), ad):
                    redis.sadd("{}Nbot:{}:TXoeders".format(BOT_ID, chatID), ad)
                orders += f"{i} - {text} > {tx}\n"
                i += 1
            Bot(
                "sendMessage", {
                    "chat_id": chatID,
                    "text":
                    f"✅꒐ تم اضافه الاوامر الاتيه \n⎯ ⎯ ⎯ ⎯\n{orders}\n⎯ ⎯ ⎯ ⎯",
                    "reply_to_message_id": message.message_id,
                    "disable_web_page_preview": True
                })

        if re.search(c.del_ac, text) and Ckuser(message):
            H = "acreator"
            redis.delete("{}Nbot:{}:{}".format(BOT_ID, chatID, H))
            Bot(
                "sendMessage", {
                    "chat_id": chatID,
                    "text": r.DoneDelList,
                    "reply_to_message_id": message.message_id,
                    "disable_web_page_preview": True
                })

        if re.search(c.acreators, text) and Ckuser(message):
            arrays = redis.smembers("{}Nbot:{}:acreator".format(
                BOT_ID, chatID))
            if arrays:
                b = BYusers(arrays, chatID, redis, client)
                kb = InlineKeyboardMarkup([[
                    InlineKeyboardButton(r.delList.format(text),
                                         callback_data=json.dumps(
                                             ["delList", "acreator", userID]))
                ]])
                if b is not "":
                    Bot(
                        "sendMessage", {
                            "chat_id": chatID,
                            "text": r.showlist.format(text, b),
                            "reply_to_message_id": message.message_id,
                            "parse_mode": "markdown",
                            "reply_markup": kb
                        })
                else:
                    Bot(
                        "sendMessage", {
                            "chat_id": chatID,
                            "text": r.listempty.format(text),
                            "reply_to_message_id": message.message_id,
                            "parse_mode": "markdown"
                        })
            else:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.listempty.format(text),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown"
                    })

        if re.search(c.setacreator, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.setacreator2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = setrank(redis, "acreator", userId, chatID, "array")
                if setcr is "acreator":
                    send_msg("UD", client, message, r.DsetRK, "", getUser,
                             redis)
                elif (setcr is True or setcr is 1):
                    send_msg("UD", client, message, r.setRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        if re.search(c.remacreator, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.remacreator2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = remrank(redis, "acreator", userId, chatID, "array")
                if setcr:
                    send_msg("UD", client, message, r.remRK, "", getUser,
                             redis)
                elif not setcr:
                    send_msg("UD", client, message, r.DremRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

    if (rank is "sudo" or rank is "asudo" or rank is "sudos" or rank is "malk"
            or rank is "acreator"):
        if re.search(c.del_cr, text) and Ckuser(message):
            H = "creator"
            redis.delete("{}Nbot:{}:{}".format(BOT_ID, chatID, H))
            Bot(
                "sendMessage", {
                    "chat_id": chatID,
                    "text": r.DoneDelList,
                    "reply_to_message_id": message.message_id,
                    "disable_web_page_preview": True
                })

        if re.search(c.creators, text) and Ckuser(message):
            arrays = redis.smembers("{}Nbot:{}:creator".format(BOT_ID, chatID))
            if arrays:
                b = BYusers(arrays, chatID, redis, client)
                kb = InlineKeyboardMarkup([[
                    InlineKeyboardButton(r.delList.format(text),
                                         callback_data=json.dumps(
                                             ["delList", "creator", userID]))
                ]])
                if b is not "":
                    Bot(
                        "sendMessage", {
                            "chat_id": chatID,
                            "text": r.showlist.format(text, b),
                            "reply_to_message_id": message.message_id,
                            "parse_mode": "markdown",
                            "reply_markup": kb
                        })
                else:
                    Bot(
                        "sendMessage", {
                            "chat_id": chatID,
                            "text": r.listempty.format(text),
                            "reply_to_message_id": message.message_id,
                            "parse_mode": "markdown"
                        })
            else:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.listempty.format(text),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown"
                    })

        if re.search(c.setcreator, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.setcreator2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = setrank(redis, "creator", userId, chatID, "array")
                if setcr is "creator":
                    send_msg("UD", client, message, r.DsetRK, "", getUser,
                             redis)
                elif (setcr is True or setcr is 1):
                    send_msg("UD", client, message, r.setRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        if re.search(c.remcreator, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.remcreator2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = remrank(redis, "creator", userId, chatID, "array")
                if setcr:
                    send_msg("UD", client, message, r.remRK, "", getUser,
                             redis)
                elif not setcr:
                    send_msg("UD", client, message, r.DremRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

    if (rank is "sudo" or rank is "asudo" or rank is "sudos" or rank is "malk"
            or rank is "acreator" or rank is "creator" or rank is "owner"):

        if re.search(c.del_ad, text) and Ckuser(message):
            H = "admin"
            redis.delete("{}Nbot:{}:{}".format(BOT_ID, chatID, H))
            Bot(
                "sendMessage", {
                    "chat_id": chatID,
                    "text": r.DoneDelList,
                    "reply_to_message_id": message.message_id,
                    "disable_web_page_preview": True
                })
        if re.search(c.del_vp, text) and Ckuser(message):
            H = "vip"
            redis.delete("{}Nbot:{}:{}".format(BOT_ID, chatID, H))
            Bot(
                "sendMessage", {
                    "chat_id": chatID,
                    "text": r.DoneDelList,
                    "reply_to_message_id": message.message_id,
                    "disable_web_page_preview": True
                })

        if re.search(c.admins, text) and Ckuser(message):
            arrays = redis.smembers("{}Nbot:{}:admin".format(BOT_ID, chatID))
            b = BYusers(arrays, chatID, redis, client)
            kb = InlineKeyboardMarkup([[
                InlineKeyboardButton(r.delList.format(text),
                                     callback_data=json.dumps(
                                         ["delList", "admin", userID]))
            ]])
            if b is not "":
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.showlist.format(text, b),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown",
                        "reply_markup": kb
                    })
            else:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.listempty.format(text),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown"
                    })

        if re.search(c.vips, text) and Ckuser(message):

            arrays = redis.smembers("{}Nbot:{}:vip".format(BOT_ID, chatID))
            b = BYusers(arrays, chatID, redis, client)
            kb = InlineKeyboardMarkup([[
                InlineKeyboardButton(r.delList.format(text),
                                     callback_data=json.dumps(
                                         ["delList", "vip", userID]))
            ]])
            if b is not "":
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.showlist.format(text, b),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown",
                        "reply_markup": kb
                    })
            else:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.listempty.format(text),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown"
                    })

        orad = redis.hget("{}Nbot:adminor:cb".format(BOT_ID),
                          chatID) or c.setadmin
        orad2 = redis.hget("{}Nbot:adminor:cb2".format(BOT_ID),
                           chatID) or c.setadmin2
        if re.search(c.setadmin + "|" + orad, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.setadmin2 + "|" + orad2, text):
                user = int(re.search(r'\d+', text).group())
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            message.text = c.orad
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = setrank(redis, "admin", userId, chatID, "array")
                if setcr is "admin":
                    send_msg("UD", client, message, r.DsetRK, "", getUser,
                             redis)
                elif (setcr is True or setcr is 1):
                    send_msg("UD", client, message, r.setRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        if re.search(c.remadmin, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.remadmin2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = remrank(redis, "admin", userId, chatID, "array")
                if setcr:
                    send_msg("UD", client, message, r.remRK, "", getUser,
                             redis)
                elif not setcr:
                    send_msg("UD", client, message, r.DremRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        orvip = redis.hget("{}Nbot:vipor:cb".format(BOT_ID),
                           chatID) or c.setvip
        orvip2 = redis.hget("{}Nbot:vipor:cb2".format(BOT_ID),
                            chatID) or c.setvip2
        if re.search(c.setvip + "|" + orvip, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.setvip2 + "|" + orvip2, text):
                user = int(re.search(r'\d+', text).group())
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            message.text = c.orvip
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = setrank(redis, "vip", userId, chatID, "array")
                if setcr is "vip":
                    send_msg("UD", client, message, r.DsetRK, "", getUser,
                             redis)
                elif (setcr is True or setcr is 1):
                    send_msg("UD", client, message, r.setRK, "", getUser,
                             redis)
            except Exception as e:
                import traceback
                traceback.print_exc()
                print(e)
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        if re.search(c.remvip, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.remvip2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = remrank(redis, "vip", userId, chatID, "array")
                if setcr:
                    send_msg("UD", client, message, r.remRK, "", getUser,
                             redis)
                elif not setcr:
                    send_msg("UD", client, message, r.DremRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

    if (rank is "sudo" or rank is "sudos" or rank is "asudo" or rank is "malk"
            or rank is "acreator" or rank is "creator"):
        if re.search(c.del_ow, text) and Ckuser(message):
            H = "owner"
            redis.delete("{}Nbot:{}:{}".format(BOT_ID, chatID, H))
            Bot(
                "sendMessage", {
                    "chat_id": chatID,
                    "text": r.DoneDelList,
                    "reply_to_message_id": message.message_id,
                    "disable_web_page_preview": True
                })

        if re.search(c.owners, text) and Ckuser(message):
            arrays = redis.smembers("{}Nbot:{}:owner".format(BOT_ID, chatID))
            b = BYusers(arrays, chatID, redis, client)
            kb = InlineKeyboardMarkup([[
                InlineKeyboardButton(r.delList.format(text),
                                     callback_data=json.dumps(
                                         ["delList", "owner", userID]))
            ]])
            if b is not "":
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.showlist.format(text, b),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown",
                        "reply_markup": kb
                    })
            else:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.listempty.format(text),
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "markdown"
                    })

        orow = redis.hget("{}Nbot:owneror:cb".format(BOT_ID),
                          chatID) or c.setowner
        orow2 = redis.hget("{}Nbot:owneror:cb2".format(BOT_ID),
                           chatID) or c.setowner2
        if re.search(c.setowner + "|" + orow, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.setowner2 + "|" + orow2, text):
                user = int(re.search(r'\d+', text).group())
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            message.text = c.orow
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = setrank(redis, "owner", userId, chatID, "array")
                if setcr is "owner":
                    send_msg("UD", client, message, r.DsetRK, "", getUser,
                             redis)
                elif (setcr is True or setcr is 1):
                    send_msg("UD", client, message, r.setRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })

        if re.search(c.remowner, text) and Ckuser(message):
            if re.search("@", text):
                user = text.split("@")[1]
            if re.search(c.remowner2, text):
                user = text.split(" ")[2]
            if message.reply_to_message:
                user = message.reply_to_message.from_user.id
            if 'user' not in locals(): return False
            try:
                getUser = client.get_users(user)
                userId = getUser.id
                userFn = getUser.first_name
                setcr = remrank(redis, "owner", userId, chatID, "array")
                if setcr:
                    send_msg("UD", client, message, r.remRK, "", getUser,
                             redis)
                elif not setcr:
                    send_msg("UD", client, message, r.DremRK, "", getUser,
                             redis)
            except Exception as e:
                Bot(
                    "sendMessage", {
                        "chat_id": chatID,
                        "text": r.userNocc,
                        "reply_to_message_id": message.message_id,
                        "parse_mode": "html"
                    })
Esempio n. 5
0
def sudo(client, message,redis):
	type = message.chat.type
	userID = message.from_user.id
	chatID = message.chat.id
	rank = isrank(redis,userID,chatID)
	text = message.text
	title = message.chat.title
	userFN = message.from_user.first_name
	type = message.chat.type
	lang = Glang(redis,chatID)
	moduleCMD = "lang."+lang+"-cmd"
	moduleREPLY = "lang."+lang+"-reply"
	c = importlib.import_module(moduleCMD)
	r = importlib.import_module(moduleREPLY)
	if redis.hexists("{}Nbot:stepSUDO".format(BOT_ID),userID):
		tx = redis.hget("{}Nbot:stepSUDO".format(BOT_ID),userID)
		if text :
			redis.hset("{}Nbot:TXreplys".format(BOT_ID),tx,text)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRtext.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
		
		if message.sticker:
			ID = message.sticker.file_id
			redis.hset("{}Nbot:STreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRst.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if message.animation:
			ID = message.animation.file_id
			redis.hset("{}Nbot:GFreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRgf.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if message.voice:
			ID = message.voice.file_id
			redis.hset("{}Nbot:VOreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRvo.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if message.photo:
			ID = message.photo.file_id
			redis.hset("{}Nbot:PHreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRph.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
		if message.document:
			ID = message.document.file_id
			redis.hset("{}Nbot:DOreplys".format(BOT_ID),tx,ID)
			redis.hdel("{}Nbot:stepSUDO".format(BOT_ID),userID)
			Bot("sendMessage",{"chat_id":chatID,"text":r.SRfi.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})



	if text and (type is "supergroup" or type is "group"):
		if re.search(c.leaveChatS, text):
			Bot("leaveChat",{"chat_id":chatID})
			redis.srem("{}Nbot:groups".format(BOT_ID),chatID)
			redis.sadd("{}Nbot:disabledgroups".format(BOT_ID),chatID)
			NextDay_Date = datetime.datetime.today() + datetime.timedelta(days=1)
			redis.hset("{}Nbot:disabledgroupsTIME".format(BOT_ID),chatID,str(NextDay_Date))

		if re.search(c.creators, text) and Ckuser(message):
			text = text.replace("مسح ","")
			arrays = redis.get("{}Nbot:{}:creator".format(BOT_ID,chatID))
			if arrays:
				print(arrays)
				b = BYusers({arrays},chatID,redis,client)
				kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.delList.format(text), callback_data=json.dumps(["delList","creator",userID]))]])
				if	b is not "":
					Bot("sendMessage",{"chat_id":chatID,"text":r.showlist.format(text,b),"reply_to_message_id":message.message_id,"parse_mode":"markdown","reply_markup":kb})
				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.creatorempty,"reply_to_message_id":message.message_id,"parse_mode":"markdown"})
			else:
				Bot("sendMessage",{"chat_id":chatID,"text":r.creatorempty,"reply_to_message_id":message.message_id,"parse_mode":"markdown"})

		if re.search(c.setcreator, text) and Ckuser(message):
			if re.search("@",text):
				user = text.split("@")[1]
			if re.search(c.setcreator2,text):
				user = text.split(" ")[2]
			if message.reply_to_message:
				user = message.reply_to_message.from_user.id
			if 'user' not in locals():return False
			try:
				getUser = client.get_users(user)
				userId = getUser.id
				userFn = getUser.first_name
				setcr = setrank(redis,"creator",userId,chatID,"one")
				if setcr is "creator":
					send_msg("UD",client, message,r.DsetRK,"",getUser,redis)
				elif (setcr is True or setcr is 1):
					send_msg("UD",client, message,r.setRK,"",getUser,redis)
			except Exception as e:
				Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if re.search(c.remcreator, text) and Ckuser(message):
			if re.search("@",text):
				user = text.split("@")[1]
			if re.search(c.remcreator2,text):
				user = text.split(" ")[2]
			if message.reply_to_message:
				user = message.reply_to_message.from_user.id
			if 'user' not in locals():return False
			try:
				getUser = client.get_users(user)
				userId = getUser.id
				userFn = getUser.first_name
				setcr = remrank(redis,"creator",userId,chatID,"one")
				if setcr:
					send_msg("UD",client, message,r.remRK,"",getUser,redis)
				elif not setcr:
					send_msg("UD",client, message,r.DremRK,"",getUser,redis)
			except Exception as e:
				Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})


	if text and (type is "private" or (type is "supergroup" or type is "group")) :
		if re.search(c.STreplyBOT, text):
			tx = text.replace(c.RPreplyBOT,"")
			if redis.hexists("{}Nbot:TXreplys".format(BOT_ID,chatID),tx):
				Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:STreplys".format(BOT_ID,chatID),tx):
				Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:GFreplys".format(BOT_ID,chatID),tx):
				Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:VOreplys".format(BOT_ID,chatID),tx):
				Bot("sendMessage",{"chat_id":chatID,"text":r.Yrp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			else:
				redis.hset("{}Nbot:stepSUDO".format(BOT_ID),userID,tx)
				kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.MoreInfo, url="t.me/vvhvvv")]])
				Bot("sendMessage",{"chat_id":chatID,"text":r.Sendreply % tx,"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})
			


		if re.search(c.DLreplyBOT, text):
			tx = text.replace(c.RPdreplyBOT,"")
			if redis.hexists("{}Nbot:TXreplys".format(BOT_ID,chatID),tx):
				redis.hdel("{}Nbot:TXreplys".format(BOT_ID,chatID),tx)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:STreplys".format(BOT_ID,chatID),tx):
				redis.hdel("{}Nbot:STreplys".format(BOT_ID,chatID),tx)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:GFreplys".format(BOT_ID,chatID),tx):
				redis.hdel("{}Nbot:GFreplys".format(BOT_ID,chatID),tx)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			elif redis.hexists("{}Nbot:VOreplys".format(BOT_ID,chatID),tx):
				redis.hdel("{}Nbot:GFreplys".format(BOT_ID,chatID),tx)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Drp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})
			else:
				Bot("sendMessage",{"chat_id":chatID,"text":r.Norp.format(tx),"reply_to_message_id":message.message_id,"parse_mode":"html"})

		if re.search(c.ReplylistBOT, text):
			reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STword,callback_data=json.dumps(["showreplylistBOT","",userID])),InlineKeyboardButton(c.STgifs,callback_data=json.dumps(["showGFreplylistBOT","",userID])),],[InlineKeyboardButton(c.STvoice,callback_data=json.dumps(["showVOreplylistBOT","",userID])),InlineKeyboardButton(c.STsticker,callback_data=json.dumps(["showSTreplylistBOT","",userID])),]])
			Bot("sendMessage",{"chat_id":chatID,"text":r.blocklist.format(text,title),"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":reply_markup})



		if rank is "sudo":
			if text == c.remfiles:
				onlyfiles = [f for f in listdir("files") if isfile(join("files", f))]
				array = []
				if not onlyfiles:
					Bot("sendMessage",{"chat_id":chatID,"text":r.NOaddfiles2,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
					return False
				for f in onlyfiles:
					array.append([InlineKeyboardButton(f,callback_data=json.dumps(["delF",f,userID]))])
				array.append([InlineKeyboardButton(c.remallfiles,callback_data=json.dumps(["delFa","",userID]))])
				kb = InlineKeyboardMarkup(array)
				Bot("sendMessage",{"chat_id":chatID,"text":r.dlFiles,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True,"reply_markup":kb})


			if text == c.files:
				onlyfiles = [f for f in listdir("files") if isfile(join("files", f))]
				filesR = redis.smembers("{}Nbot:botfiles".format(BOT_ID))
				array = []
				print(onlyfiles)
				if not onlyfiles:
					Bot("sendMessage",{"chat_id":chatID,"text":r.NOaddfiles2,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
					return False
				for f in onlyfiles:
					if f in filesR:
						s = r.true
					else:
						s = r.false
					array.append([InlineKeyboardButton(f+" "+s,callback_data=json.dumps(["au",f,userID]))])
				kb = InlineKeyboardMarkup(array)
				Bot("sendMessage",{"chat_id":chatID,"text":r.Files,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True,"reply_markup":kb})

			if text == c.ADDfiles:
				url = "https://raw.githubusercontent.com/Nitro/NB-files/master/files"
				req = requests.get(url).text
				if not re.search(".py",req):
					Bot("sendMessage",{"chat_id":chatID,"text":r.NOaddfiles,"reply_to_message_id":message.message_id,"disable_web_page_preview":True,"parse_mode":"html"})
					return False

				files = req.split("\n")
				array = []
				for f in files:
					array.append([InlineKeyboardButton(f,callback_data=json.dumps(["dlf",f,userID]))])
				kb = InlineKeyboardMarkup(array)
				Bot("sendMessage",{"chat_id":chatID,"text":r.addFiles,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True,"reply_markup":kb})


			if text == c.Ubot:
				Files_H = ["inline.py","all.py","callback.py","delete.py","edit.py","gpcmd.py","locks.py","msg.py","nf.py","ranks.py","sudo.py"]
				#Files_H = ["gpcmd.py"]
				Files_U = ["tg.py","locks.py","rank.py","send.py"]
				Files_B = ["bot.py","setup.py"]
				for fnh in Files_H:
					url = "https://raw.githubusercontent.com/Nitro/NB/master/handlers/"+fnh
					out = requests.get(url).text
					f = open("./handlers/"+fnh,"w+")
					f.write(out)
					f.close()
				for fnu in Files_U:
					url = "https://raw.githubusercontent.com/Nitro/NB/master/utlis/"+fnu
					out = requests.get(url).text
					f = open("./utlis/"+fnu,"w+")
					f.write(out)
					f.close()
				for fnb in Files_B:
					url = "https://raw.githubusercontent.com/Nitro/NB/master/"+fnb
					out = requests.get(url).text
					f = open("./"+fnb,"w+")
					f.write(out)
					f.close()
				Bot("sendMessage",{"chat_id":chatID,"text":r.Wres,"reply_to_message_id":message.message_id,"parse_mode":"html"})
				run(redis,chatID)
				

			if text == c.Ulang:
				t = r.Dulang
				t2 = r.Wres
				os.system("rm -rf lang;git clone https://github.com/Nitro/Nitro-lang.git;sudo cp -R Nitro-lang/lang lang/; rm -rf Nitro-lang")
				Bot("sendMessage",{"chat_id":chatID,"text":t,"reply_to_message_id":message.message_id,"parse_mode":"html"})
				Bot("sendMessage",{"chat_id":chatID,"text":t2,"reply_to_message_id":message.message_id,"parse_mode":"html"})
				run(redis,chatID)
			if re.search(c.setSudoC, text):
				tx = text.replace(c.RsetSudoC,"")
				v = Bot("sendMessage",{"chat_id":chatID,"text":tx,"reply_to_message_id":message.message_id,"parse_mode":"html"})
				if v["ok"]:
					redis.set("{}Nbot:SHOWsudos".format(BOT_ID),tx)
					Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShow,"reply_to_message_id":message.message_id,"parse_mode":"html"})
				elif v["ok"] == False:
					Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.sudosList, text) and Ckuser(message):
				text = text.replace("مسح ","")
				arrays = redis.smembers("{}Nbot:sudos".format(BOT_ID,chatID))
				b = BYusers(arrays,chatID,redis,client)
				kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.delList.format(text), callback_data=json.dumps(["delList","sudos",userID]))]])
				if	b is not "":
					Bot("sendMessage",{"chat_id":chatID,"text":r.showlist.format(text,b),"reply_to_message_id":message.message_id,"parse_mode":"markdown","reply_markup":kb})
				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.listempty.format(text),"reply_to_message_id":message.message_id,"parse_mode":"markdown"})

			if re.search(c.setsudos, text) and Ckuser(message):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.setsudos2,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					setcr = setsudos(redis,userId)
					if setcr is "sudos":
						send_msg("UD",client, message,r.DsetRK,"",getUser,redis)
					elif (setcr is True or setcr is 1):
						send_msg("UD",client, message,r.setRK,"",getUser,redis)
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.remsudos, text) and Ckuser(message):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.remsudos2,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					setcr = remsudos(redis,userId)
					if setcr:
						send_msg("UD",client, message,r.remRK,"",getUser,redis)
					elif not setcr:
						send_msg("UD",client, message,r.DremRK,"",getUser,redis)
				except Exception as e:
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})
			
			if re.search(c.banall, text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.ban2all,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					BY = "<a href=\"tg://user?id={}\">{}</a>".format(userId,userFn)
					Getrank = isrank(redis,userId,chatID)
					GetGprank = GPranks(userId,chatID)
					if Getrank == "bot":return False
					if Getrank == "sudos" or Getrank == "sudo":
						Bot("sendMessage",{"chat_id":chatID,"text":r.cTsudo,"reply_to_message_id":message.message_id,"parse_mode":"html"})
						return False
					if redis.sismember("{}Nbot:bans".format(BOT_ID),userId):
						Bot("sendMessage",{"chat_id":chatID,"text":r.Dbanall.format(BY),"reply_to_message_id":message.message_id,"parse_mode":"html"})
					else:
						redis.sadd("{}Nbot:bans".format(BOT_ID),userId)
						Bot("sendMessage",{"chat_id":chatID,"text":r.banall.format(BY),"reply_to_message_id":message.message_id,"parse_mode":"html"})
						if (GetGprank == "member" or GetGprank == "restricted"):
							Bot("kickChatMember",{"chat_id":chatID,"user_id":userId})
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.unbanall, text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.unban2all,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					Getrank = isrank(redis,userId,chatID)
					GetGprank = GPranks(userId,chatID)
					if Getrank == "bot":return False
					if redis.sismember("{}Nbot:bans".format(BOT_ID),userId):
						redis.srem("{}Nbot:bans".format(BOT_ID),userId)
						send_msg("BNN",client, message,r.unbanall,"bans",getUser,redis)
					else:
						send_msg("BNN",client, message,r.Dunbanall,"bans",getUser,redis)
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.TKall, text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.TK2all,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					Getrank = isrank(redis,userId,chatID)
					GetGprank = GPranks(userId,chatID)
					if Getrank == "bot":return False
					if Getrank == "sudos" or Getrank == "sudo":
						Bot("sendMessage",{"chat_id":chatID,"text":r.cTsudo,"reply_to_message_id":message.message_id,"parse_mode":"html"})
						return False
					if redis.sismember("{}Nbot:restricteds".format(BOT_ID),userId):
						send_msg("BNN",client, message,r.Drestrictedall,"restricteds",getUser,redis)
					else:
						send_msg("BNN",client, message,r.restrictedall,"restricteds",getUser,redis)
						redis.sadd("{}Nbot:restricteds".format(BOT_ID),userId)
						if (GetGprank == "member"):
							Bot("restrictChatMember",{"chat_id": chatID,"user_id": userId,"can_send_messages": 0,"can_send_media_messages": 0,"can_send_other_messages": 0,
						    "can_send_polls": 0,"can_change_info": 0,"can_add_web_page_previews": 0,"can_pin_messages": 0,"can_invite_users": 0,})
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.unTKall, text):
				if re.search("@",text):
					user = text.split("@")[1]
				if re.search(c.unTK2all,text):
					user = text.split(" ")[2]
				if message.reply_to_message:
					user = message.reply_to_message.from_user.id
				if 'user' not in locals():return False
				try:
					getUser = client.get_users(user)
					userId = getUser.id
					userFn = getUser.first_name
					Getrank = isrank(redis,userId,chatID)
					GetGprank = GPranks(userId,chatID)
					if Getrank == "bot":return False
					if redis.sismember("{}Nbot:restricteds".format(BOT_ID),userId):
						send_msg("BNN",client, message,r.unrestrictedall,"restricteds",getUser,redis)
						redis.srem("{}Nbot:restricteds".format(BOT_ID),userId)
					else:
						send_msg("BNN",client, message,r.Dunrestrictedall,"restricteds",getUser,redis)
				except Exception as e:
					print(e)
					Bot("sendMessage",{"chat_id":chatID,"text":r.userNocc,"reply_to_message_id":message.message_id,"parse_mode":"html"})

			if re.search(c.Alllist, text) and Ckuser(message):
				reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STbanall,callback_data=json.dumps(["showbanall","",userID])),InlineKeyboardButton(c.STtkall,callback_data=json.dumps(["showtkall","",userID])),]])
				Bot("sendMessage",{"chat_id":chatID,"text":r.banlist,"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":reply_markup})
			
			
			if re.search(c.stats, text) and Ckuser(message):
				pr = redis.scard("{}Nbot:privates".format(BOT_ID))
				gp = redis.scard("{}Nbot:groups".format(BOT_ID))
				kb = InlineKeyboardMarkup([[InlineKeyboardButton(r.CKgps,callback_data=json.dumps(["ckGPs","",userID]))]])
				Bot("sendMessage",{"chat_id":chatID,"text":r.showstats.format(gp,pr),"reply_to_message_id":message.message_id,"parse_mode":"html","reply_markup":kb})
			
			if re.search(c.fwdall, text) and message.reply_to_message:
				Bot("forwardMessage",{"chat_id":chatID,"from_chat_id":chatID,"message_id":message.reply_to_message.message_id})
				reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["fwdtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["fwdtoprivates","",userID])),]])
				Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})

			if re.search(c.showGPS, text) and Ckuser(message):
				IDS = redis.smembers("{}Nbot:groups".format(BOT_ID))
				GPslist = ""
				i = 1
				for ID in IDS:
					get = Bot("getChat",{"chat_id":ID})
					if get["ok"]:
						Title = (get["result"]["title"] or "None")
						Link = (redis.hget("{}Nbot:links".format(BOT_ID),ID) or GetLink(ID) or "none")
						name = "[{}]({})".format(Title,Link)
						N = r.ShowGPN.format(i,name,ID)
						GPslist = GPslist+"\n\n"+N
						i +=1
				sendM("NO",GPslist,message)
			
			if text == c.Laudo :
				R = text.split(" ")[1]
				get = redis.get("{}Nbot:autoaddbot".format(BOT_ID))
				BY = "<a href=\"tg://user?id={}\">{}</a>".format(userID,userFN)
				if get :
					Bot("sendMessage",{"chat_id":chatID,"text":r.ADDed.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
				else:
					save = redis.set("{}Nbot:autoaddbot".format(BOT_ID),1)
					Bot("sendMessage",{"chat_id":chatID,"text":r.ADD.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})

			if text == c.Uauto :
				R = text.split(" ")[1]
				BY = "<a href=\"tg://user?id={}\">{}</a>".format(userID,userFN)
				get = redis.get("{}Nbot:autoaddbot".format(BOT_ID),chatID)
				if get :
					save = redis.delete("{}Nbot:autoaddbot".format(BOT_ID))
					Bot("sendMessage",{"chat_id":chatID,"text":r.unADD.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
				else:
					Bot("sendMessage",{"chat_id":chatID,"text":r.unADDed.format(BY,R),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
			if re.search(c.Setauto, text):
				N = text.split(" ")[2]
				redis.set("{}Nbot:autoaddbotN".format(BOT_ID),int(N))
				Bot("sendMessage",{"chat_id":chatID,"text":r.SetAuto.format(N),"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})
			if re.search(c.leaveChat,text):
				ch = text.split(" ")[1]
				Bot("leaveChat",{"chat_id":ch})
				redis.srem("{}Nbot:groups".format(BOT_ID),ch)
				redis.sadd("{}Nbot:disabledgroups".format(BOT_ID),ch)
				NextDay_Date = datetime.datetime.today() + datetime.timedelta(days=1)
				redis.hset("{}Nbot:disabledgroupsTIME".format(BOT_ID),ch,str(NextDay_Date))
				Bot("sendMessage",{"chat_id":chatID,"text":r.DoneleaveChat,"reply_to_message_id":message.message_id,"parse_mode":"html","disable_web_page_preview":True})




			if re.search(c.sendall, text) and message.reply_to_message and Ckuser(message):
				if message.reply_to_message.text:
					v = Bot("sendMessage",{"chat_id":chatID,"text":message.reply_to_message.text,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.photo:
					ID = message.reply_to_message.photo.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendphoto",{"chat_id":chatID,"photo":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.voice:
					ID = message.reply_to_message.voice.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendvoice",{"chat_id":chatID,"voice":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.audio:
					ID = message.reply_to_message.audio.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendaudio",{"chat_id":chatID,"audio":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.document:
					ID = message.reply_to_message.document.file_id
					CP = message.reply_to_message.caption
					v = Bot("senddocument",{"chat_id":chatID,"document":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})



				if message.reply_to_message.sticker:
					ID = message.reply_to_message.sticker.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendsticker",{"chat_id":chatID,"sticker":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.animation:
					ID = message.reply_to_message.animation.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendanimation",{"chat_id":chatID,"animation":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.video:
					ID = message.reply_to_message.video.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendvideo",{"chat_id":chatID,"video":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})

				if message.reply_to_message.video_note:
					ID = message.reply_to_message.video_note.file_id
					CP = message.reply_to_message.caption
					v = Bot("sendVideoNote",{"chat_id":chatID,"video_note":ID,"caption":CP,"reply_to_message_id":message.message_id,"parse_mode":"html"})
					if v["ok"]:
						reply_markup=InlineKeyboardMarkup([[InlineKeyboardButton(c.STgroup,callback_data=json.dumps(["sendtogroups","",userID])),InlineKeyboardButton(c.STprivates,callback_data=json.dumps(["sendtoprivates","",userID])),]])
						Bot("sendMessage",{"chat_id":chatID,"text":r.sendto,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html","reply_markup":reply_markup})
					elif v["ok"] == False:
						Bot("sendMessage",{"chat_id":chatID,"text":r.DsetSudosShowE,"reply_to_message_id":message.reply_to_message.message_id,"parse_mode":"html"})