def start(client, message): # Hoş Geldin Mesajı message.reply_chat_action("typing") client.send_message(message.from_user.id,text='text',reply_markup=main_keyboard) message.reply(f"☣ **KekikRAT** ☣\n\nBütün veriler [Patron](tg://user?id={adminID})'a Gönderilecek!") # LOG Alanı log = f"[{message.from_user.first_name}](tg://user?id={message.from_user.id}) | Bota Bağlantı Sağladı" #client.send_message(adminID, "Look at that button!", reply_markup=ReplyKeyboardMarkup([["Nice!"]])) client.send_message( message.from_user.id, "İşte Sana : `InlineKeyboardMarkup`", reply_markup=InlineKeyboardMarkup( [ [InlineKeyboardButton("Data", callback_data="hidden_callback_data")], [InlineKeyboardButton("Docs", url="https://docs.pyrogram.org")] ] )) client.send_message( message.from_user.id, "Aşağıdakiler de : `ReplyKeyboardMarkup`", reply_markup=ReplyKeyboardMarkup( [ ["Nice!"], ["Perfect"], ["Bravo Piç"] ], resize_keyboard=True ))
async def settings_sticker(_client, message): if not DB_AVAILABLE: await message.edit("Your database is not avaiable!") return global TEMP_KEYBOARD, USER_SET await app.send_message("@Stickers", "/stats") # app.read_history("@Stickers") time.sleep(0.2) try: keyboard = await app.get_history("@Stickers", limit=1) keyboard = keyboard[0].reply_markup.keyboard except: message.message.edit_text( "You dont have any sticker pack!\nAdd stickers pack in @Stickers ") return for x in keyboard: for y in x: TEMP_KEYBOARD.append(y) await app.send_message("@Stickers", "/cancel") await message.message.delete() msg = await setbot.send_message( Owner, "Select your stickers for set as kang animation sticker", reply_markup=ReplyKeyboardMarkup(keyboard)) USER_SET[message.from_user.id] = msg.message_id USER_SET["type"] = 2
async def rate(_client: Client, callback: CallbackQuery): _, amount, tgo_id = callback.data.split('|') accept_rate(int(tgo_id), int(amount), callback.from_user.id) info = get_info(tgo_id) await callback.edit_message_text( f"Success!\n🌟Rates average: {info.stars_average} / 5") review = await _client.ask( callback.message.chat.id, "Want to write a review?", reply_markup=ReplyKeyboardMarkup( [[KeyboardButton('Yes'), KeyboardButton('No')]], resize_keyboard=True, one_time_keyboard=True)) await review.delete() await review.request.delete() if str(review.text) == 'No': return await callback.message.reply("Thanks!", reply_markup=ReplyKeyboardRemove()) elif str(review.text) == 'Yes': review = await _client.ask(callback.message.chat.id, "Write your review:", reply_markup=ReplyKeyboardRemove()) await review.request.delete() await review.delete() await callback.message.reply("Thanks!") return await _client.send_message( info.owner, "Review from " f" [{callback.from_user.first_name}]" f"(tg://user?id={callback.from_user.id}) " f"about [this bot](tg://user?id={info.id})\n\n" f"{str(review.text)}") else: return await callback.message.reply("Stop zaccing me!")
async def _new_document(self, _: Client, message: Message): devices = [] if self._config.upnp_enabled: devices.extend(await UpnpDeviceFinder.find(self._config)) if self._config.chromecast_enabled: # noinspection PyUnresolvedReferences devices.extend(await ChromecastDeviceFinder.find(self._config)) if self._config.xbmc_enabled: devices.extend(await XbmcDeviceFinder.find(self._config)) if self._config.vlc_enabled: devices.extend(await VlcDeviceFinder.find(self._config)) if devices: try: filename = pyrogram_filename(message) except TypeError: filename = "NaN" self._state_machine.set_state( message, States.SELECT, SelectStateData(message.message_id, filename, devices.copy())) buttons = [[KeyboardButton(repr(device))] for device in devices] buttons.append([KeyboardButton(_CANCEL_BUTTON)]) markup = ReplyKeyboardMarkup(buttons, one_time_keyboard=True) await message.reply("Select a device", reply_markup=markup) else: await message.reply("Supported devices not found in the network", reply_markup=_REMOVE_KEYBOARD)
async def open_panel(_client: Client, message: Message): await message.reply( "Select Option below", reply_markup=ReplyKeyboardMarkup([ [KeyboardButton('Add new')], [KeyboardButton('My bots / channels / groups')] ], resize_keyboard=True, one_time_keyboard=True) )
def add_event(client, message): _, name, date, hour = message.text.split() year, month, day = list(map(int, date.split('/'))) hour, minute = list(map(int, hour.split(':'))) date = JalaliDateTime(year, month, day).to_gregorian() # date = date.replace(hour=hour, minute=minute, tzinfo=tehran) date = date.replace(hour=hour, minute=minute, tzinfo=tz('UTC')) events.append({date: [name, message.chat.id]}) message.reply("Time", reply_markup=ReplyKeyboardMarkup( [["1 Week Before", "1 Day Before", "1 Hour Before"]], resize_keyboard=True))
async def get_stickers(client, message): global TEMP_KEYBOARD, USER_SET await app.send_message("@Stickers", "/stats") # app.read_history("@Stickers") time.sleep(0.2) keyboard = await app.get_history("@Stickers", limit=1) keyboard = keyboard[0].reply_markup.keyboard for x in keyboard: for y in x: TEMP_KEYBOARD.append(y) await app.send_message("@Stickers", "/cancel") msg = await message.reply("Select your stickers for set as kang sticker", reply_markup=ReplyKeyboardMarkup(keyboard)) USER_SET[message.from_user.id] = msg.message_id
def kb(rows = [], **kwargs): lines = [] for row in rows: line = [] for button in row: button_type = type(button) if button_type == str: button = KeyboardButton(button) elif button_type == dict: button = KeyboardButton(**button) line.append(button) lines.append(line) return ReplyKeyboardMarkup(keyboard=lines, **kwargs)
def handle_start(c, m): edit_home() yangilash() buyurtmalar[m.chat.id] = [] bot.send_message(m.chat.id, """Assalomu Alaykum, EZAZ | Milliy Taomlar botimizga xush kelibsiz. Iltimos, avval siz bilan bog'lanishimiz uchun o'z raqamingizni 👤 Kontakt ko'rinishda jo'nating yoki pastdagi "📲 Telefon raqamni jo'natish" tugmasini bosing:""", reply_markup=ReplyKeyboardMarkup([[ KeyboardButton("📱 Telefon raqamni jo'natish", request_contact=True), ]], resize_keyboard=True))
async def contact(_client: Client, message: Message): msg = await _client.ask(message.chat.id, "Write a messages and then press 'Done'.", reply_markup=ReplyKeyboardMarkup( [[KeyboardButton('Done')]], resize_keyboard=True)) if str(msg.text) != "Done": await _client.send_message( 'Oxcafe1c2a', "[{}](tg://user?id={}) said: \n\n\n{}".format( message.from_user.first_name, message.from_user.id, str(msg.text))) await contact(_client, message) else: await msg.delete() await message.reply("The messages was sent successfully!") await start_handler(_client, message)
async def start(app: Client, message: Message): if message.from_user.id in USERS: await message.reply_text(plate("hello", USERS[message.from_user.id])) else: await message.reply_text( "Language? Sprache? Linguaggio?", reply_markup=ReplyKeyboardMarkup( [[ KeyboardButton(DE), KeyboardButton(US), KeyboardButton(IT), ]], resize_keyboard=True, one_time_keyboard=True, ), )
async def get_stickers(_client, message): if not DB_AVAILABLE: await message.edit("Your database is not avaiable!") return global TEMP_KEYBOARD, USER_SET await app.send_message("@Stickers", "/stats") # app.read_history("@Stickers") time.sleep(0.2) keyboard = await app.get_history("@Stickers", limit=1) keyboard = keyboard[0].reply_markup.keyboard for x in keyboard: for y in x: TEMP_KEYBOARD.append(y) await app.send_message("@Stickers", "/cancel") msg = await message.reply("Select your stickers for set as kang sticker", reply_markup=ReplyKeyboardMarkup(keyboard)) USER_SET[message.from_user.id] = msg.message_id USER_SET["type"] = 1
def handle_location(c, m: Message): if manzil.get(m.chat.id, None): manzil[m.chat.id] = "Geolokatsiya" geolokatsiya[m.chat.id] = (m.location.latitude, m.location.longitude) a = distance(41.120233069494155, 69.07184731700151, m.location.latitude, m.location.longitude) xizmat_narxi[m.chat.id] = 6.0 if a >= 3: xizmat_narxi[m.chat.id] += ceil(a - 3) jami = 0.0 text = """👤 <b>Hurmatli mijoz,</b>siz tanlagan taomlar uchun doimiy ravishda "Bir martalik" idish qo'shib oboriladi. shuning uchun BOT avtomatik tarzda Quyuq taom uchun: quyuq idish(1000so'm) suyuq taom uchun: suyuq idish(1500so'm) hisoblaydi. 🛵 Yetkazib berish xizmatimiz Yangiyo'l shahar va Tumanida amal qiladi.Yetkazib berish xizmatimiz 3kmdan uzoq masofaga km hisobida 1000so'mdan qo'shib boriladi.Bu ishni BOTning o'zi avtomatik tarzda bajaradi. 👇 Siz tanlagan taomlar:\n --------------""" idishlar = 0.0 for i in buyurtmalar[m.chat.id]: if "suyuq" in i[-1].lower() or "uyg'ur" in i[-1].lower(): idishlar += 1.5 * i[2] if "quyuq" in i[-1].lower() or "salatlar" in i[-1].lower(): idishlar += 1.0 * i[2] text += "{} x {}: {}00\n".format(i[2], i[0], i[1] * i[2]) jami += i[1] * i[2] if idishlar: text += "🍽 Bir martalik idishlar: {}00\n".format(idishlar) jami += idishlar text += "🛵 Yetkazib berish hizmati: {}00\n".format( xizmat_narxi[m.chat.id]) jami += xizmat_narxi[m.chat.id] text += "<b>📋 Jami: {}00</b>\n" \ "--------------".format(jami) bot.send_message(m.chat.id, text, reply_markup=ReplyKeyboardMarkup( [[ha], [yuq], [qol]], resize_keyboard=True)) return
async def start_handler(_client: Client, message): if hasattr(message, 'reply'): callback = message.reply else: await message.message.delete() callback = message.message.reply await callback( f""" Hi {message.from_user.first_name}, Welcome. What can i do? 🔸Rate channels / bots / groups. 🔸Send Review for channels / bots / groups. 🔸Contact the admins of channel / bots / group / etc.. Want to support me? [Donate here](paypal.me/pybots) """, reply_markup=ReplyKeyboardMarkup( [[KeyboardButton('Open panel')], [KeyboardButton('Contact me')]], resize_keyboard=True, one_time_keyboard=True))
async def show_my_tg_objects(_client: Client, callback: CallbackQuery): data_splitted = callback.data.split('|') how_to_show = None if len(data_splitted) == 3: tgo_type, how_to_show = data_splitted[1:] else: tgo_type = data_splitted[1] buttons = list_of_tg_objects(callback.from_user.id, tgo_type) if not how_to_show: how_to_show = await _client.ask( callback.message.chat.id, 'How do you want to show them?', reply_markup=ReplyKeyboardMarkup( [[KeyboardButton('By name')], [KeyboardButton('By username')]], resize_keyboard=True)) await how_to_show.delete() await how_to_show.request.delete() how_to_show = how_to_show.text if buttons: try: await callback.edit_message_text( f"{Emoji.DOWN_ARROW} " + (f"Here your " + tgo_type + 's' if tgo_type != 'all' else "All of your bots / channels / groups") + f" {Emoji.DOWN_ARROW}", reply_markup=make_buttons_from_tg_objects( buttons, show_by[how_to_show] if len(how_to_show) > 1 else how_to_show, f"{tgo_type}|{show_by[how_to_show] if len(how_to_show) > 1 else how_to_show}" )) except KeyError: await callback.edit_message_text(Emoji.FACE_WITH_ROLLING_EYES) else: await callback.edit_message_text( f'Nothing to show {Emoji.MAN_SHRUGGING}')
""" from pyrogram import Client, ReplyKeyboardMarkup, InlineKeyboardMarkup, InlineKeyboardButton # Create a client using your bot token app = Client("my_bot", bot_token="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11") with app: app.send_message( "haskell", # Edit this "This is a ReplyKeyboardMarkup example", reply_markup=ReplyKeyboardMarkup( [ ["A", "B", "C", "D"], # First row ["E", "F", "G"], # Second row ["H", "I"], # Third row ["J"] # Fourth row ], resize_keyboard=True # Make the keyboard smaller )) app.send_message( "haskell", # Edit this "This is a InlineKeyboardMarkup example", reply_markup=InlineKeyboardMarkup([ [ # First row InlineKeyboardButton( # Generates a callback query when pressed "Button", callback_data=b"data" # Note how callback_data must be bytes ), InlineKeyboardButton( # Opens a web URL
def kb_home(user): kb = user.choice_localized(ru_obj=KB_HOME_RU, en_obj=KB_HOME_EN) return ReplyKeyboardMarkup(kb, resize_keyboard=True)
def one_time_keyboard(self) -> ReplyKeyboardMarkup: return ReplyKeyboardMarkup( [row.keyboard_row() for row in self._rows], resize_keyboard=True, one_time_keyboard=True, )
def updateHandlers(client, message, redis): if redis.get("{}Nbot:bigM".format(BOT_ID)): return False type = message.chat.type try: userID = message.from_user.id chatID = message.chat.id except Exception as e: return 0 c = importlib.import_module("lang.arcmd") r = importlib.import_module("lang.arreply") if (type is "supergroup" or type is "group") and message.outgoing != True: userID = message.from_user.id chatID = message.chat.id rank = isrank(redis, userID, chatID) group = redis.sismember("{}Nbot:groups".format(BOT_ID), chatID) text = message.text title = message.chat.title if text and group is False: if (rank is "sudo" or rank is "sudos" or rank is "asudo") or ( redis.get("{}Nbot:autoaddbot".format(BOT_ID)) and GPranks(userID, chatID) == "creator"): if text == c.add: if redis.get("{}Nbot:autoaddbotN".format(BOT_ID)): auN = int( redis.get("{}Nbot:autoaddbotN".format(BOT_ID))) else: auN = 1 if auN >= Bot("getChatMembersCount", { "chat_id": chatID })["result"] and not (rank is "sudo" or rank is "sudos"): Bot( "sendMessage", { "chat_id": chatID, "text": r.Toolow.format((int( redis.get( "{}Nbot:autoaddbotN".format(BOT_ID))) or 0)), "reply_to_message_id": message.message_id, "parse_mode": "html" }) return False GetME = Bot("getChatMember", { "chat_id": chatID, "user_id": BOT_ID })["result"] if (not GetME["can_change_info"] or not GetME["can_delete_messages"] or not GetME["can_invite_users"] or not GetME["can_restrict_members"] or not GetME["can_pin_messages"] or not GetME["can_promote_members"]): Bot( "sendMessage", { "chat_id": chatID, "text": r.GiveMEall, "reply_to_message_id": message.message_id, "parse_mode": "html" }) return False if text == c.add and not redis.sismember( "{}Nbot:disabledgroups".format(BOT_ID), chatID) and Ckuser(message): locksarray = { 'Llink', 'Llongtext', 'Lmarkdown', 'Linline', 'Lfiles', 'Lcontact', 'Lbots', 'Lfwd', 'Lnote' } for lock in locksarray: redis.sadd("{}Nbot:{}".format(BOT_ID, lock), chatID) 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") if ad['status'] == "creator": setrank(redis, "malk", userId, chatID, "one") add = redis.sadd("{}Nbot:groups".format(BOT_ID), chatID) Bot("exportChatInviteLink", {"chat_id": chatID}) kb = InlineKeyboardMarkup([[ InlineKeyboardButton(r.MoreInfo, url="t.me/Source_Luffy") ]]) Bot( "sendMessage", { "chat_id": chatID, "text": r.doneadd.format(title), "reply_to_message_id": message.message_id, "parse_mode": "markdown", "reply_markup": kb }) sendTO = (redis.get("{}Nbot:sudogp".format(BOT_ID)) or SUDO) get = (redis.hget("{}Nbot:links".format(BOT_ID), chatID) or GetLink(chatID) or "t.me/Source_Luffy") kb = InlineKeyboardMarkup( [[InlineKeyboardButton("الرابط 🖇", url=get)]]) BY = "<a href=\"tg://user?id={}\">{}</a>".format( userID, message.from_user.first_name) Bot( "sendMessage", { "chat_id": sendTO, "text": f"تم تفعيل مجموعه جديدة ℹ️\nاسم المجموعه : {title}\nايدي المجموعه : {chatID}\nالمنشئ : {BY}\n⎯ ⎯ ⎯ ⎯", "parse_mode": "html", "reply_markup": kb }) elif text == c.add and redis.sismember( "{}Nbot:disabledgroups".format(BOT_ID), chatID) and Ckuser(message): redis.sadd("{}Nbot:groups".format(BOT_ID), chatID) redis.srem("{}Nbot:disabledgroups".format(BOT_ID), chatID) redis.hdel("{}Nbot:disabledgroupsTIME".format(BOT_ID), chatID) Bot( "sendMessage", { "chat_id": chatID, "text": r.doneadd2.format(title), "reply_to_message_id": message.message_id, "parse_mode": "markdown" }) if text == c.disabl and Ckuser(message): Bot( "sendMessage", { "chat_id": chatID, "text": r.disabled.format(title), "reply_to_message_id": message.message_id, "parse_mode": "markdown" }) if text and group is True: if (rank is "sudo" or rank is "sudos" or rank is "asudo") or ( redis.get("{}Nbot:autoaddbot".format(BOT_ID)) and GPranks(userID, chatID) == "creator"): if text == c.add and Ckuser(message): Bot( "sendMessage", { "chat_id": chatID, "text": r.doneadded.format(title), "reply_to_message_id": message.message_id, "parse_mode": "markdown" }) if text == c.disabl and Ckuser(message): 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)) kb = InlineKeyboardMarkup([[ InlineKeyboardButton(r.MoreInfo, url="t.me/Source_Luffy") ]]) Bot( "sendMessage", { "chat_id": chatID, "text": r.disabl.format(title), "reply_to_message_id": message.message_id, "parse_mode": "markdown", "reply_markup": kb }) if group is True: t = threading.Thread(target=allGP, args=(client, message, redis)) t.daemon = True t.start() if text and group is True: x = redis.smembers("{}Nbot:{}:TXoeders".format(BOT_ID, chatID)) for x in x: try: x = x.split("=") if re.search(f"^\{x[0]}$", text) or re.search( f"^\{x[0]} (.*)$", text): text = text.replace(x[0], x[1]) except Exception as e: print(e) message.text = text if (rank is "sudo" or rank is "sudos" or rank is "asudo") and group is True: t = threading.Thread(target=sudo, args=(client, message, redis)) t.daemon = True t.start() if text and (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") and group is True: t = threading.Thread(target=ranks, args=(client, message, redis)) t.daemon = True t.start() if text and (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" or rank is "admin") and group is True and re.search( c.startlock, text): if Ckuser(message): t = threading.Thread(target=locks, args=(client, message, redis)) t.daemon = True t.start() if (rank is False or rank is 0) and group is True: t = threading.Thread(target=delete, args=(client, message, redis)) t.daemon = True t.start() 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" or rank is "admin") and group is True: t = threading.Thread(target=gpcmd, args=(client, message, redis)) t.daemon = True t.start() if type is "private" and message.outgoing != True: text = message.text rank = isrank(redis, userID, chatID) if (rank is "sudo" or rank is "asudo" or rank is "sudos"): t = threading.Thread(target=sudo, args=(client, message, redis)) t.daemon = True t.start() if text and re.search("^/start$", text): userID = message.from_user.id userFN = message.from_user.first_name redis.sadd("{}Nbot:privates".format(BOT_ID), userID) if rank == "sudo": kb = ReplyKeyboardMarkup( [[r.RKgp, r.RKgpl], [r.RKaf, r.RKrf], [r.RKf], ["جلب نسخه احتياطيه"], [r.RKub]], resize_keyboard=True) Bot( "sendMessage", { "chat_id": chatID, "text": r.sudostart, "reply_to_message_id": message.message_id, "parse_mode": "html", "reply_markup": kb }) return 0 getbot = client.get_me() kb = InlineKeyboardMarkup([[ InlineKeyboardButton("Source Luffy", url="t.me/Source_Luffy") ]]) Bot( "sendMessage", { "chat_id": chatID, "text": r.botstart.format(getbot.first_name, getbot.username), "reply_to_message_id": message.message_id, "parse_mode": "html", "reply_markup": kb }) if text and re.search("^/start (.*)$", text): tx = text.replace("/start ", "") split = tx.split("=") order = split[0] if order == "showreplylistBOT": chatId = split[1] userId = split[2] TY = split[3] rank = isrank(redis, userId, chatId) if (rank == "sudo" or rank is "asudo" or rank == "sudos"): li = redis.hkeys("{}Nbot:{}".format(BOT_ID, TY)) if li: i = 1 words = "" for word in li: words = words + "\n" + str(i) + " - {" + word + "}" i += 1 if len(words) > 3000: Bot( "sendMessage", { "chat_id": userId, "text": words, "reply_to_message_id": message.message_id, "parse_mode": "html" }) words = '' Bot( "sendMessage", { "chat_id": userId, "text": words, "reply_to_message_id": message.message_id, "parse_mode": "html" }) reply_markup = InlineKeyboardMarkup([[ InlineKeyboardButton( r.Delall2R, callback_data=json.dumps( ["del{}".format(TY + 'BOT'), "", userID])), ]]) Bot( "sendMessage", { "chat_id": chatID, "text": r.DelallR, "reply_to_message_id": message.message_id, "disable_web_page_preview": True, "reply_markup": reply_markup }) if order == "showreplylist": chatId = split[1] userId = split[2] TY = split[3] group = redis.sismember("{}Nbot:groups".format(BOT_ID), chatId) rank = isrank(redis, userId, chatId) if (rank is not False or rank is not 0 or rank != "vip" or rank != "admin") and group is True: li = redis.hkeys("{}Nbot:{}:{}".format(BOT_ID, chatId, TY)) if li: i = 1 words = "" for word in li: words = words + "\n" + str(i) + " - {" + word + "}" i += 1 if len(words) > 3000: Bot( "sendMessage", { "chat_id": userId, "text": words, "reply_to_message_id": message.message_id, "parse_mode": "html" }) words = '' Bot( "sendMessage", { "chat_id": userId, "text": words, "reply_to_message_id": message.message_id, "parse_mode": "html" }) reply_markup = InlineKeyboardMarkup([[ InlineKeyboardButton(r.Delall2R, callback_data=json.dumps([ "del{}".format(TY), chatId, userID ])), ]]) Bot( "sendMessage", { "chat_id": chatID, "text": r.DelallR, "reply_to_message_id": message.message_id, "disable_web_page_preview": True, "reply_markup": reply_markup }) if order == "showBlocklist": chatId = split[1] userId = split[2] TY = split[3] group = redis.sismember("{}Nbot:groups".format(BOT_ID), chatId) rank = isrank(redis, userId, chatId) if (rank is not False or rank is not 0 or rank != "vip") and group is True: redis.hset("{}Nbot:{}:TXreplys".format(BOT_ID, chatID), tx, text) li = redis.smembers("{}Nbot:{}:{}".format( BOT_ID, chatId, TY)) if li: i = 1 words = "" for ID in li: reply_markup = InlineKeyboardMarkup([[ InlineKeyboardButton(r.Blocklistone, callback_data=json.dumps([ "delfromb", TY, userID, chatId ])), ]]) if TY == "blockanimations": Bot( "sendAnimation", { "chat_id": userId, "animation": ID, "reply_markup": reply_markup }) if TY == "blockSTICKERs": Bot( "sendSticker", { "chat_id": userId, "sticker": ID, "reply_markup": reply_markup }) if TY == "blockphotos": Bot( "sendPhoto", { "chat_id": userId, "photo": ID, "reply_markup": reply_markup }) if TY == "blockTEXTs": words = words + "\n" + str( i) + " - {" + ID + "}" i += 1 print(len(words)) if len(words) > 3000: Bot( "sendMessage", { "chat_id": userId, "text": words, "reply_to_message_id": message.message_id, "parse_mode": "html" }) words = '' if TY == "blockTEXTs": Bot( "sendMessage", { "chat_id": userId, "text": words, "reply_to_message_id": message.message_id, "parse_mode": "html" }) reply_markup = InlineKeyboardMarkup([[ InlineKeyboardButton(r.Delall2, callback_data=json.dumps([ "delBL", TY, userID, chatId ])), ]]) Bot( "sendMessage", { "chat_id": userId, "text": r.Delall, "reply_to_message_id": message.message_id, "parse_mode": "html", "reply_markup": reply_markup }) else: Bot( "sendMessage", { "chat_id": userId, "text": r.listempty2, "reply_to_message_id": message.message_id, "parse_mode": "html" })
from utils import * from filters import * logging.basicConfig(filename="logs.txt", format='%(asctime)s %(message)s', filemode='a') logger = logging.getLogger() app = Client("my_bot", config.api_id, config.api_hash, bot_token=config.token, workers=config.threads) sleeping_time = 15 home_markup = ReplyKeyboardMarkup( [["Balance", "Spend"], ["Top up", "How to use?"]], resize_keyboard=True) help_markup = InlineKeyboardMarkup([[ InlineKeyboardButton("Add LIKE bot to your group", url="https://t.me/minterlikebot?startgroup=hbase") ]]) @app.on_message(Filters.command(["start"]) & Filters.private) def send_welcome(client, message): tg_analytic.statistics(message.chat.id, "start") app.send_message( message.chat.id, f"Hi! Get LIKEs in groups and spend on anything.\n\nFor group owner: Add @MinterLikeBot to your group to get 10% of each transaction.", reply_markup=home_markup)
ob_havo = get_weather() or ob_havo bosh = bosh_shablon.format(hafta[dt.date.today().weekday()], dt.date.today(), *ob_havo) edit_home() bolimlar = ReplyKeyboardMarkup( [ ["1⃣ Suyuq Taomlar", "2⃣ Quyuq Taomlar"], [ "🍜 Uyg'ur Taomlar", "🍢 Kaboblar", ], ["🍻 BAR", "🥗 Salatlar"], [ korzina, # tayyor buyurtma ], [sozlamalar, qoidalar], [ boglanish, # tayyor manzil_ # tayyor ], ], resize_keyboard=True) raqamlar = ReplyKeyboardMarkup([["1", "2", "3"], ["4", "5", "6"], ["7", "8", "9"], [ortga, menu], [ korzina, ]], resize_keyboard=True)
def handle_text(c, m: Message): edit_home() global buyurtmalar, temp, info if m.text.lower() == "yangila": yangilash() return if m.chat.id == -1001149535338: yangilash() return if m.chat.id == guruh_id: if m.text.lower().startswith("info"): text = "Bugun:\n" for k, v in info.items(): text += "{}ta {};\n".format(v, k) text += "sotildi" bot.send_message(m.chat.id, text) return elif m.text.lower().startswith("tozala"): info = {} m.reply("Ma'lumotlar to'liq tozalandi!") return elif m.text.lower().startswith("javob"): if m.text.split("\n")[1] == "hammaga": for i in phone_numbers.keys(): try: bot.send_message(i, '\n'.join(m.text.split('\n')[2:])) except: pass else: try: bot.send_message( m.text.split('\n')[1], '\n'.join(m.text.split('\n')[2:])) except: pass return elif m.text == ortga: fikr[m.chat.id] = None if not temp.get(m.chat.id) or len(temp.get(m.chat.id, [])) <= 1: temp[m.chat.id] = None bot.send_message(m.chat.id, bosh, reply_markup=bolimlar) return else: # print(1) temp[m.chat.id] = [temp[m.chat.id][0]] x = [] try: bot.send_message(m.chat.id, choice(faktlar[temp[m.chat.id][0]])) except: pass for i, t in enumerate(taomlar[temp[m.chat.id][0]]): a, b = i // 2, i % 2 if b == 0: x.append([]) x[a].append(t[1]) x.append([ortga, korzina]) x.append([buyurtma]) # print(2) x = ReplyKeyboardMarkup(x, resize_keyboard=True) bot.send_message(m.chat.id, "{} :".format(temp[m.chat.id][0]), reply_markup=x) return elif fikr.get(m.chat.id, 0): text = "{} `{}` mavzu: {}\n\n".format(m.from_user.first_name, m.from_user.id, fikr[m.chat.id]) text += m.text bot.send_message(guruh_id, text) bot.send_message( m.chat.id, "Rahmat adminstratorlar albatta siz bilan bo'glanadi.", reply_markup=bolimlar) fikr[m.chat.id] = None elif m.text == manzil_: bot.send_location(m.chat.id, 41.120233069494155, 69.07184731700151) bot.send_message( m.chat.id, """🍴 Ezaz Milliy Taomlar: 🇺🇿 Toshkent viloyati,Yangiyo'l shahar,Toshkent shox. 34-uy. """) return elif m.text == menu: bot.send_message(m.chat.id, bosh, reply_markup=bolimlar) temp[m.chat.id] = None return elif m.text == boglanish: x = ReplyKeyboardMarkup( [[shikoyat], [taklif], [xatolik], [shunchaki], [ ortga, ]], resize_keyboard=True) bot.send_message(m.chat.id, """✉️ Telegram orqali: @EzazAdmin 📞 Telefon orqali: +998951466616 📧 Elektron Pochta: [email protected] 📷 Instagram: http://instagram.com/ezazmilliytaomlar <b>✍ Marhamat: qay tarzda bog'lanmoqchisiz ?</b>""", reply_markup=x) return elif m.text == qoidalar: bot.send_message( m.chat.id, """ 👤 <b>Hurmatli mijoz,</b>siz tanlagan taomlar uchun doimiy ravishda "Bir martalik" idish qo'shib oboriladi. shuning uchun BOT avtomatik tarzda Quyuq taom uchun: quyuq idish(1000so'm) suyuq taom uchun: suyuq idish(1500so'm) hisoblaydi. 🛵 Yetkazib berish xizmatimiz Yangiyo'l shahar va Tumanida amal qiladi.Yetkazib berish xizmatimiz 3kmdan uzoq masofaga km hisobida 1000so'mdan qo'shib boriladi.Bu ishni BOTning o'zi avtomatik tarzda bajaradi. ⚠️Bundan tashqari albatta mahsulot yetkazib berilgandan so'ng siz mahsulotlar nomi yozilgan mahsus chekni talab qilishingiz mumkun bo'ladi. 👨💻Shikoyat yoki qandaydir taklif murojaatlar bo'lsa "Bog'lanish" bo'limiga o'tishingiz mumkin,Adminstratorlar albatta siz bilan bog'lanadi. 👤 KONTAKTLAR: @EZAZSUPPORTBOT +998951466616 +998903366807 """) elif m.text == korzina: try: if not buyurtmalar[m.chat.id]: bot.send_message( m.chat.id, "🧐 Siz hali taom tanlamadingiz \"🔙 Ortga\" qaytib taom tanlang va Savatga yig'ib " "boring.🛒", reply_markup=ReplyKeyboardMarkup([[ortga]], resize_keyboard=True)) return except KeyError: buyurtmalar[m.chat.id] = [] bot.send_message( m.chat.id, '🧐 Siz hali taom tanlamadingiz "🔙 Ortga" qaytib taom tanlang va Savatga yig\'ib boring.🛒', reply_markup=ReplyKeyboardMarkup([[ortga]], resize_keyboard=True)) return else: x = [] text = "👇 Siz tanlagan taomlar:\n\n" for i in buyurtmalar[m.chat.id]: # print(i) text += "{}x{}: {}00\n".format(i[2], i[0], i[1] * i[2]) x.append([ KeyboardButton("❌ {}ni bekor qilish".format(i[0]), request_contact=False) ]) x.append([buyurtma]) x.append([tozalash]) x.append([ortga]) x = ReplyKeyboardMarkup(x, resize_keyboard=True) bot.send_message(m.chat.id, text, reply_markup=x) return elif m.text == sozlamalar: bot.send_message( m.chat.id, "Sozlamalar orqali siz bilan bog'lanishimiz mumkin bo'lgan raqamingizni o'zgartirishingiz mumkin:", reply_markup=ReplyKeyboardMarkup( [[KeyboardButton(telefon, request_contact=True)], [ortga]], resize_keyboard=True)) return elif m.text == tozalash: buyurtmalar[m.chat.id] = [] bot.send_message(m.chat.id, """Siz tanlagan barcha taomlar to'liq tozalandi. 👇 Kerakli taomlar bo'limni tanlang:""", reply_markup=ReplyKeyboardMarkup( [[ortga, menu]], resize_keyboard=True)) return elif m.text == shikoyat: fikr[m.chat.id] = 'shikoyat' bot.send_message(m.chat.id, """<b>Qanday shikoyat qilmoqchisiz ?</b> 🔸 O'z fikringizni yozib qoldiring albatta inobatga olamiz:""", reply_markup=ReplyKeyboardMarkup( [[ortga]], resize_keyboard=True)) return elif m.text == taklif: fikr[m.chat.id] = 'taklif' bot.send_message(m.chat.id, """<b>Qanday taklifingiz bor ?</b> 🔸 O'z fikringizni yozib qoldiring albatta inobatga olamiz:""", reply_markup=ReplyKeyboardMarkup( [[ortga]], resize_keyboard=True)) return elif m.text == xatolik: fikr[m.chat.id] = 'xatolik' bot.send_message(m.chat.id, """<b>Qanday xatolik topdingiz ?</b> 🔸 O'z fikringizni yozib qoldiring albatta inobatga olamiz:""", reply_markup=ReplyKeyboardMarkup( [[ortga]], resize_keyboard=True)) return elif m.text == shunchaki: fikr[m.chat.id] = 'shunchaki' bot.send_message( m.chat.id, """🔸 O'z fikringizni yozib qoldiring albatta inobatga olamiz:""", reply_markup=ReplyKeyboardMarkup([[ortga]], resize_keyboard=True)) return elif m.text == buyurtma: x = buyurtmalar.get(m.chat.id, None) if x is None: buyurtmalar[m.chat.id] = [] if not x: bot.send_message( m.chat.id, '🧐 Siz hali taom tanlamadingiz "🔙 Ortga" qaytib taom tanlang va Savatga yig\'ib boring.🛒', reply_markup=ReplyKeyboardMarkup([[ortga, menu]], resize_keyboard=True)) return jami = 0.0 text = "👇 Siz tanlagan taomlar: \n\n" for i in buyurtmalar[m.chat.id]: # print(i) text += "{} x {}: {}00\n".format(i[2], i[0], i[1] * i[2]) jami += i[1] * i[2] bot.send_message(m.chat.id, text) x = ReplyKeyboardMarkup([[ha], [yuq], [qol]], resize_keyboard=True) bot.send_message(m.chat.id, "Tasdiqlaysizmi ❓", reply_markup=x) return elif m.text == ha and not xizmat_narxi.get(m.chat.id, 0): manzil[m.chat.id] = True bot.send_message( m.chat.id, """Iltimos oldin manzilni aniqlash uchun "📍<b>Geolokatsiya</b>" tugmasini bosib manzilni jo'nating:""", reply_markup=ReplyKeyboardMarkup( [[KeyboardButton("📍 Geolokatsiya", request_location=True)]], resize_keyboard=True)) return elif m.text == ha: komment[m.chat.id] = True bot.send_message( m.chat.id, "💬 Istasangiz, buyurtmangiz haqida izoh kommentariya yozib qoldirishingiz mumkin.Biz uni albatta inobatga olamiz.", reply_markup=ReplyKeyboardMarkup([["Shart emas"]], resize_keyboard=True)) return elif m.text == yuq: buyurtmalar[m.chat.id] = [] bot.send_message(m.chat.id, """Siz tanlagan taomlaringiz to'liq tozalandi 👇 Kerakli taomlar bo'limni tanlang:""", reply_markup=ReplyKeyboardMarkup( [[ortga, menu]], resize_keyboard=True)) return elif m.text == qol: bot.send_message(m.chat.id, """Taomlaringiz savatda saqlandi 👇 Kerakli taomlar bo'limni tanlang:""", reply_markup=ReplyKeyboardMarkup( [[ortga, menu]], resize_keyboard=True)) elif m.text in taomlar.keys(): x = [] try: bot.send_message(m.chat.id, choice(faktlar[m.text])) except: pass for i, t in enumerate(taomlar[m.text]): a, b = i // 2, i % 2 if b == 0: x.append([]) x[a].append(t[1]) x.append([ortga, korzina]) x = ReplyKeyboardMarkup(x, resize_keyboard=True) temp[m.chat.id] = [m.text] bot.send_message(m.chat.id, "{} :".format(m.text), reply_markup=x) return elif manzil.get(m.chat.id, 0) and komment.get(m.chat.id, 0): text = "{} (`{}`) {} buyurtma berdi:\n".format( m.from_user.first_name, m.chat.id, m.from_user.last_name or "") idishlar = 0.0 jami = 0.0 for n, i in enumerate(buyurtmalar[m.chat.id]): text += "{}) {} x {} {}00\n".format(n + 1, i[0], i[2], i[1] * i[2]) jami += i[1] * i[2] if "suyuq" in i[-1].lower() or "uyg'ur" in i[-1].lower(): idishlar += 1.5 * i[2] if "quyuq" in i[-1].lower() or "salatlar" in i[-1].lower(): idishlar += 1.0 * i[2] if idishlar: text += "🍽 Bir martalik idishlar: {}00\n".format(idishlar) text += "🛵 Yetkazib berish hizmati: {}00\n".format( xizmat_narxi[m.chat.id]) jami += xizmat_narxi[m.chat.id] text += "🔖 Jami: {0}00\n\n".format(jami + idishlar) text += "📞 Tel: {}\n📍 Manzil: {}".format(phone_numbers[m.chat.id], manzil[m.chat.id]) text += "\n💬 Komment: {}".format(m.text) bot.send_message(guruh_id, text) bot.send_location(guruh_id, *geolokatsiya[m.chat.id]) for i in buyurtmalar[m.chat.id]: a = info.get(i[-1], 0) + i[2] info[i[-1]] = a temp[m.chat.id] = None manzil[m.chat.id] = None komment[m.chat.id] = None buyurtmalar[m.chat.id] = [] bot.send_message( m.chat.id, "Rahmat,tez orada adminstratorlarimiz albatta siz bilan bog'lanishadi " "👇 Kerakli taomlar bo'limini tanlang:", reply_markup=bolimlar) return elif "bekor qilish" in m.text: import re s = re.search(r"(\w*) bekor", m.text) s = s.groups()[0][:-2] # print(s) for i in buyurtmalar[m.chat.id]: if s in i[0]: buyurtmalar[m.chat.id].remove(i) break x = [] jami = 6.0 text = "👇 Siz tanlagan taomlar:\n\n" for i in buyurtmalar[m.chat.id]: # print(i) text += "{}x{}: {}00\n".format(i[2], i[0], i[1] * i[2]) jami += i[1] * i[2] x.append([ KeyboardButton("❌ {}ni bekor qilish".format(i[0]), request_contact=False) ]) x.append([buyurtma]) x.append([tozalash]) x.append([ortga]) text += "\nYetkazib berish: 6.000\n\nJami: {}00".format(jami) x = ReplyKeyboardMarkup(x, resize_keyboard=True) bot.send_message(m.chat.id, text, reply_markup=x) return elif temp.get(m.chat.id, 0) and len(temp[m.chat.id]) == 1: bol = temp[m.chat.id][0] x = None for i in taomlar[bol]: if m.text in i: x = i break if x is None: return # print(x) if "ro'yxat" in m.text.lower(): bot.send_photo(m.chat.id, x[0]) return temp[m.chat.id].append(m.text) temp[m.chat.id].append(x[2]) if x[3]: bot.send_photo( m.chat.id, x[0], caption="""{}\nNarxi: {}00so'm""".format(x[1], x[2]), reply_markup=ReplyKeyboardMarkup([[x[3]], [x[4]]], resize_keyboard=True)) if x[-1]: bot.send_message(m.chat.id, x[-1]) else: bot.send_photo(m.chat.id, x[0], caption="""{}\nNarxi: {}00so'm""".format( x[1], x[2]), reply_markup=raqamlar) if x[-1]: bot.send_message(m.chat.id, x[-1]) bot.send_message(m.chat.id, "👇 Miqdorni kiriting yoki o'zingiz yozing:") return elif temp.get(m.chat.id, 0) and len(temp[m.chat.id]) == 3: if len(m.text) <= 2: soni = int(m.text) temp[m.chat.id].append(soni) try: # nomi #narxi #soni buyurtmalar[m.chat.id].append( (temp[m.chat.id][1], temp[m.chat.id][2], soni, temp[m.chat.id][0])) except KeyError: buyurtmalar[m.chat.id] = [] buyurtmalar[m.chat.id].append( (temp[m.chat.id][1], temp[m.chat.id][2], soni, temp[m.chat.id][0])) bot.send_message( m.chat.id, "🛒 Siz tanlagan taomlar savatga qo'shildi Buyurtma Berish bo'limiga kirib buyurtma qilishingiz mumkin!" "", reply_markup=bolimlar) return else: temp[m.chat.id][1] += " {}".format(m.text) bot.send_message(m.chat.id, "👇 Miqdorni kiriting yoki o'zingiz yozing:", reply_markup=raqamlar) elif m.text == "🔙 Ortga": bot.send_message(m.chat.id, "👇 Kerakli taomlar bo'limini tanlang:", reply_markup=bolimlar) temp[m.chat.id] = None return elif m.text == "👨💻 Bog'lanish": bot.send_message( m.chat.id, """✉️ Telegram orqali: @EzazAdmin 📞 Telefon orqali: +998951466616 📧 Elektron Pochta: [email protected] 📷 Instagram: http://instagram.com/ezazmilliytaomlar """) return
from pyrogram import Client, Filters, InlineKeyboardMarkup, InlineKeyboardButton, ReplyKeyboardMarkup, ReplyKeyboardRemove from os import listdir KekikRAT = Client( api_id=xxxxx, # my.telegram.org/apps api_hash="xxxx", # my.telegram.org/apps session_name = "@KekikRAT", # Fark Etmez bot_token = "xxxx:xxxx", # @BotFather ) adminID = xxxx # Kendi Kullanıcı id'niz main_keyboard = ReplyKeyboardMarkup( [ ['1'], ['2'], ['3'] ], resize_keyboard=True ) @KekikRAT.on_message(Filters.command(['start'], ['!','.','/'])) def start(client, message): # Hoş Geldin Mesajı message.reply_chat_action("typing") client.send_message(message.from_user.id,text='text',reply_markup=main_keyboard) message.reply(f"☣ **KekikRAT** ☣\n\nBütün veriler [Patron](tg://user?id={adminID})'a Gönderilecek!") # LOG Alanı log = f"[{message.from_user.first_name}](tg://user?id={message.from_user.id}) | Bota Bağlantı Sağladı" #client.send_message(adminID, "Look at that button!", reply_markup=ReplyKeyboardMarkup([["Nice!"]]))
async def add_bot(_client: Client, callback: CallbackQuery, message="What's the username of your group?"): await callback.message.delete() username = await _client.ask(callback.message.chat.id, message) # noqa if str(username.text) == '/start': return await start_handler(_client, callback.message) try: username = str(username.text) if username.isdigit(): if username.isdigit(): return (await add_bot( _client, callback, "Do not send an ID, only username. try again.\n" "What's the username of your channel?")) group = await _client.get_chat(username) except (IndexError, ValueError, KeyError, UsernameNotOccupied, UsernameInvalid, PeerIdInvalid) as e: return (await add_bot( _client, callback, ("username not exist. try again.\n" if not isinstance( e, IndexError) else 'Something went wrong, try again\n') + "What's the username of your group?")) if group.type not in ('group', 'supergroup'): await add_bot( _client, callback, "This username not belong to a group, try again.\n" "What's the username of your group?") else: code = get_code() await _client.ask( callback.message.chat.id, "How to authorise the group:\n" "Go to 'manage group'\n" f"Then add this code: `{code}` to your group description,\n" f"then press 'Done'\n" "[Then remove this from your group description]", timeout=200, filters=Filters.regex('Done'), reply_markup=ReplyKeyboardMarkup([[KeyboardButton('Done')]], resize_keyboard=True)) bot = await _client.get_chat(username) if code in bot.description: await callback.message.reply('OK!', reply_markup=ReplyKeyboardRemove()) else: await callback.message.reply('Code not found! try again', reply_markup=ReplyKeyboardRemove()) return await add_bot(_client, callback) add = add_tg(group.id, group.title, callback.from_user.id, group.username, 'group') if add: await callback.message.reply( "That's the details about the group:\n" f"🔸Owner: {callback.from_user.first_name}" f"{callback.from_user.last_name or ''}" f" [{callback.from_user.id}]\n" f"🔸Group name: {add.name}\n" f"🔸Group id: {add.id}\n" + (f"🔸Group username: {add.username or ''}\n" if group. username else '') + f"\n\nRate link:\nt.me/TheRatesBot?start={add.id}") else: await callback.message.reply("The group already exist!")
def reply(tg_id): kb = ReplyKeyboardMarkup([["💳 My Wallet"], ["🆔 My Address"]], resize_keyboard=True) return kb
def generate_section_pad(): return ReplyKeyboardMarkup( keyboard = [ [KeyboardButton( text = x )] for x in custom_service_bot_class.SECTION ], resize_keyboard = True, one_time_keyboard = True)