def rm_texts(message): userid = str(message.from_user.id) chatid = str(message.chat.id) try: if checkAdminMode(message) == True: StateAdminEnd[userid] = '' markup = types.ForceReply(selective=False) if texts == []: bot.send_message(chatid, '您似乎并没有定义无回复命中语段!') return bot.send_message(chatid, '正在打印回复清单') for i in texts: bot.send_message(chatid, str(texts[i])) bot.send_message(chatid, '请输入您要删除的回复(输入-1终止):', reply_markup=markup) StateAdmin[userid] = '#RemoveTexts#' else: bot.reply_to(message, not_admin) except Exception as e: rid = getReportID() traceback.print_exc() logging.error( str(rid + '::' + str(repr(e)) + '\n' + traceback.format_exc()))
def adding_list(msg): user = User.get_by_id(msg.chat.id) if msg.text == '-': bot.send_message(msg.chat.id, _("Canceled"), reply_markup=mps.main_mp(msg.chat.id)) return elif len(msg.text) > 255: bot.send_message( msg.chat.id, _("Too long name. Max length is 255 symbols. Try another name: ")) bot.register_next_step_handler_by_chat_id(msg.chat.id, adding_list) return creating_list = List.get_or_none((List.name == msg.text) & (List.owner == user)) if creating_list is not None: sent_msg = bot.send_message( chat_id=msg.chat.id, text=_( "You have already created list with this name. Try another:"), reply_markup=types.ForceReply()) bot.register_next_step_handler(sent_msg, adding_list) else: creating_list = List.create(name=msg.text, owner=user) creating_list.subscribed_by = creating_list creating_list.save() bot.send_message(chat_id=msg.from_user.id, text=_("List _%s_ created") % msg.text, parse_mode='markdown', reply_markup=mps.main_mp(user.id)) msg_list = bot.send_message(chat_id=msg.from_user.id, text="📝 *%s*" % msg.text, parse_mode='markdown', reply_markup=mps.list_mp(creating_list.id)) creating_list.last_message_id = msg_list.message_id creating_list.save()
def send_welcome(message): def _registration(message): if message.text == REGISTRATION_CODE: bot.send_chat_action(message.chat.id, STATUS_TYPING) bot.send_message(chat_id, "Excellent, thanks!") bot.send_message(chat_id, "Let me start our conversation by sharing a dummy log that you can use to test my capabilities...") bot.send_document(chat_id, open("logs/firstLog.xes", "rb")) copyfile("logs/firstLog.xes", pm.get_log_filename(chat_id)) pm.set_property(chat_id, "current_log", pm.get_log_filename(chat_id)) pm.set_property(chat_id, "log_original_name", "firstLog.xes") bot.send_message(chat_id, "If you want, you can also share another log with me, simply by uploading it here") pm.set_property(chat_id, "registered", True) else: bot.send_chat_action(message.chat.id, STATUS_TYPING) bot.reply_to(message, "I'm sorry, this license code is not correct \u2639") pm.set_property(chat_id, "registered", False) chat_id = message.chat.id tracker.track(chat_id, "start") bot.send_chat_action(message.chat.id, STATUS_TYPING) bot.send_message(chat_id, "Hi " + message.from_user.first_name + ", and welcome to the Process Mining Bot!") markup = types.ForceReply(selective=False) license = bot.send_message(chat_id, "I need to know your license code: (a valid code is \""+ REGISTRATION_CODE +"\")", reply_markup=markup) bot.register_next_step_handler(license, _registration)
def callback_inline(call): # bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, # text=call.from_user.id) # Если сообщение из чата с ботом if call.message: if call.data == "add_new": #create dont have login stage 0 conversation = conversation_line.query.filter_by(id=call.from_user.id).first() telegram_users_insta_account_stage_0 = telegram_users_insta_accounts.query.filter_by(stage=0).first() telegram_users_insta_account_stage_1 = telegram_users_insta_accounts.query.filter_by(stage=1).first() if telegram_users_insta_account_stage_0 == None and telegram_users_insta_account_stage_1 == None: telegram_users_insta_account = telegram_users_insta_accounts(call.from_user.id) db.session.add(telegram_users_insta_account) db.session.commit() markup = types.ForceReply(selective=False) bot.edit_message_text(chat_id=call.message.chat.id, message_id=call.message.message_id, text="Enter instagram login:"******"rus": text = 'Русский Greetings! Im Sunny SMM Robot! Send` /instagram ` to set up instagram settings. Want to know about all my options?' \ ' Send` /help `and a list of the commands available for you will show up.`' user_markup = telebot.types.ReplyKeyboardMarkup(True, False) user_markup.row('Site', 'FAQ') bot.send_message(call.from_user.id, text, reply_markup=user_markup) conversation_line.update().where(id == call.from_user.id).values(stage=1) elif call.data == 'eng': text = 'Greetings! Im Sunny SMM Robot! Send` /instagram ` to set up instagram settings. Want to know about all my options?' \ ' Send` /help `and a list of the commands available for you will show up.`' user_markup = telebot.types.ReplyKeyboardMarkup(True, False) user_markup.row('Site', 'FAQ') bot.send_message(call.from_user.id, text, reply_markup=user_markup) conversation_line.update().where(id == call.from_user.id).values(stage=1)
def post_command(message): if check_legit(message): markup = types.ForceReply(selective=False) bot.send_message(message.chat.id, 'Reply me with message you want to schedule', reply_markup=markup)
def send_welcome(message): markup = types.ForceReply(selective=False) bot.send_message(message.chat.id, "Введите название города:", reply_markup=markup)
def remove_rating_for(user_id, bot=None): _, chat_id = db.get_user_data(user_id) markup = types.ForceReply(selective=False) user_answer = bot.send_message(chat_id, 'Which anime do you want to remove?', reply_markup=markup) bot.register_next_step_handler(user_answer, find_anime, bot=bot)
def send_feature(message): markup = types.ForceReply(selective=False) bot.send_message(message.chat.id, feature_msg, reply_markup=markup)
step120Button2 = types.InlineKeyboardButton('구인 정보', callback_data="120-2") step120Keyboard.row(step120Button1, step120Button2) step120Keyboard.row(reSelect) """ 예제 결과화면 만들기 위해 잠시 수정 articleKeyboard = types.InlineKeyboardMarkup(3) articleKeyboard2 = types.InlineKeyboardMarkup(2) articleKeyboardDetail = types.InlineKeyboardButton('자세히', callback_data="aDetail") articleKeyboardNext = types.InlineKeyboardButton('다른 기사', callback_data="aNext") articleKeyboardLink = types.InlineKeyboardButton('링크로 이동', callback_data="aLink") articleKeyboard.row(articleKeyboardDetail, articleKeyboardLink, articleKeyboardNext) articleKeyboard2.row(articleKeyboardLink, articleKeyboardNext) """ hideBoard = types.ReplyKeyboardHide() forceBoard = types.ForceReply() def get_user_step(uid): #cur = conn.cursor() if uid in userStep: return userStep[uid] else: if uid not in knownUsers: knownUsers.append(uid) cur.execute( "INSERT INTO users (PK_uid, step, high, kgroupIT, kgroupEconomy) VALUES (" + str(uid) + ",0,0,0,0)") conn.commit() userStep[uid] = 0 print("새로운 user_step \"/start\"")
def default_response(message): session_bot = sessionmaker(engine_bot)() user = session_bot.query(User).filter(User.id == message.from_user.id).first() if not message.chat.id in last_questions.keys(): last_questions[message.chat.id] = 'None' if last_questions[message.chat.id] == 'Откуда узнали о нас?': new_message = Message(sender_id = message.from_user.id, date = datetime.now(), text = message.text, message_type = 'q1' ) bot.send_message(message.chat.id, 'Насколько довольны обслуживанием от 1 до 10?', reply_markup = question2_markup) for comm in sql_commands: if comm in new_message.text: new_message.text = 'SOMEONE TRIED TO BREAK INTO USING SQL INJECTION' session_bot.add(new_message) session_bot.commit() last_questions[message.chat.id] = 'Насколько довольны обслуживанием от 1 до 10?' elif last_questions[message.chat.id] == 'Насколько довольны обслуживанием от 1 до 10?': new_message = Message(sender_id = message.from_user.id, date = datetime.now(), text = message.text, message_type = 'q2' ) bot.send_message(message.chat.id, 'Что, на Ваш взгляд, необходимо нам улучшить в своей работе?', reply_markup = types.ForceReply(selective = False)) last_questions[message.chat.id] = 'Что, на Ваш взгляд, необходимо нам улучшить в своей работе?' for comm in sql_commands: if comm in new_message.text: new_message.text = 'SOMEONE TRIED TO BREAK INTO USING SQL INJECTION' session_bot.add(new_message) session_bot.commit() elif message.text == '--Меню--': bot.send_message(message.chat.id,'<b>============ МЕНЮ =======</b>', reply_markup = menu_markup, parse_mode = 'html') elif last_questions[message.chat.id] == 'Что, на Ваш взгляд, необходимо нам улучшить в своей работе?': new_message = Message(sender_id = message.from_user.id, date = datetime.now(), text = message.text, message_type = 'q4' ) bot.send_message(message.chat.id, 'Будете ли рекомендовать друзьям?', reply_markup = question3_markup) try: for admin_id in ADMIN_IDS: bot.send_message(admin_id,'Что, на Ваш взгляд, необходимо нам улучшить в своей работе? \nСообщение от @{} \nНомер телефона: {} \nСодержание: \n{}'.format( message.from_user.username,user.phone_number,message.text)) except: print('Something went wrong. Admins were not notified') last_questions[message.chat.id] = 'Будете ли рекомендовать друзьям?' for comm in sql_commands: if comm in new_message.text: new_message.text = 'SOMEONE TRIED TO BREAK INTO USING SQL INJECTION' session_bot.add(new_message) session_bot.commit() elif last_questions[message.chat.id] == 'Будете ли рекомендовать друзьям?': new_message = Message(sender_id = message.from_user.id, date = datetime.now(), text = message.text, message_type = 'q3' ) if not user.phone_number: bot.send_message(message.chat.id,'Оставьте пожалуйста номер телефона, возможно руководство свяжется для выяснения деталей замечания если таковые имеются. Спасибо!', reply_markup = types.ReplyKeyboardRemove(selective=False)) last_questions[message.chat.id] = 'Оставьте пожалуйста номер телефона, возможно руководство свяжется для выяснения деталей замечания если таковые имеются. Спасибо!' else: bot.send_message(message.chat.id,'Спасибо, ваш отзыв был записан!', reply_markup = types.ReplyKeyboardMarkup(resize_keyboard = True).row(types.KeyboardButton('--Меню--')) ) bot.send_message(message.chat.id,'<b>============ МЕНЮ =======</b> ', reply_markup = menu_markup,parse_mode = 'html') for comm in sql_commands: if comm in new_message.text: new_message.text = 'SOMEONE TRIED TO BREAK INTO USING SQL INJECTION' session_bot.add(new_message) session_bot.commit() elif last_questions[message.chat.id] == 'Укажите ваш номер телефона' or last_questions[message.chat.id] == 'Оставьте пожалуйста номер телефона, возможно руководство свяжется для выяснения деталей замечания если таковые имеются. Спасибо!': valid = True if len(message.text) <= 7 or len(message.text) >= 12: valid = False for symb in message.text: if symb not in valid_symbols: valid = False break if valid: user.phone_number = message.text session_bot.commit() if last_questions[message.chat.id] == 'Укажите ваш номер телефона': bot.send_message(message.chat.id, 'Какая услуга или вопрос Вас интересует?', reply_markup = types.ForceReply(selective= False)) last_questions[message.chat.id] = 'Какая услуга или вопрос Вас интересует?' else: bot.send_message(message.chat.id,'Спасибо, ваш отзыв был записан!', reply_markup = types.ReplyKeyboardMarkup(resize_keyboard = True).row(types.KeyboardButton('--Меню--')) ) bot.send_message(message.chat.id,'<b>============ МЕНЮ =======</b> ', reply_markup = menu_markup,parse_mode = 'html') else: if last_questions[message.chat.id] == 'Укажите ваш номер телефона': bot.send_message(message.chat.id, 'Укажите ваш номер телефона', reply_markup = portfolio_markup) else: bot.send_message(message.chat.id,'Спасибо, ваш отзыв был записан!', reply_markup = types.ReplyKeyboardMarkup(resize_keyboard = True).row(types.KeyboardButton('--Меню--')) ) bot.send_message(message.chat.id,'<b>============ МЕНЮ =======</b> ', reply_markup = menu_markup,parse_mode = 'html') elif last_questions[message.chat.id] == 'Какая услуга или вопрос Вас интересует?': new_message = Message(sender_id = message.from_user.id, date = datetime.now(), text = message.text, message_type = 'question' ) bot.send_message(message.chat.id, 'Ваше сообщение было успешно отправлено!', reply_markup = types.ReplyKeyboardMarkup(resize_keyboard = True).row(types.KeyboardButton('--Меню--'))) try: for admin_id in ADMIN_IDS: bot.send_message(admin_id,'Какая услуга или вопрос Вас интересует? \nСообщение от @{} \nНомер телефона: {} \nСодержание: \n{}'.format( message.from_user.username,user.phone_number,message.text)) except: print('Something went wrong. Admins were not notified') for comm in sql_commands: if comm in new_message.text: new_message.text = 'SOMEONE TRIED TO BREAK INTO USING SQL INJECTION' session_bot.add(new_message) session_bot.commit() session_bot.close()
def handle_add_alumno(m): cid = m.chat.id bot.send_message(cid, "Dime el nombre del alumno.", reply_markup=types.ForceReply()) user_step[str(cid)] = 'add_alumno'
def key(msg): markup = types.ForceReply(selective=False) if msg.chat.id == idi: bot.send_message(msg.chat.id, 'اضف المشترك💚', reply_markup=markup)
def an(msg): x = msg.text ch = msg.chat.id markup = types.ForceReply(selective=False) try: if msg.reply_to_message.text == 'اضف المشترك💚': x = msg.text open('instagrm.txt', 'a').write(f'{x}\n') bot.send_message(x, 'تم تفعيل لك البوت💚 ') except: pass try: if msg.reply_to_message.text == "ارسل يوزرك 💚": if ch in q: z = q.index(ch) q.remove(z) q.remove(z) q.remove(z) q.remove(z) q.remove(z) else: q.append(ch) global user user = x q.append(user) bot.send_message(msg.chat.id, 'ارسل رمز حسابك 💚', reply_markup=markup) except: pass try: if msg.reply_to_message.text == "تم تسجيل الدخول بنجاح\nارسل الهاشتاك المراد التفاعل به💟": global hash if x[0] == '#': hash = x[1:] q.append(hash) else: hash = x q.append(hash) bot.send_message(msg.chat.id, 'ارسل تعليقك 📝', reply_markup=markup) except: pass try: if msg.reply_to_message.text == "ارسل تعليقك 📝": global hashtag, comment com = x q.append(com) # open('msg.txt', 'a', encoding='UTF-8').write(f':{x}') bot.reply_to(msg, 'حسنا سيتم بدء التفاعل ☑️') # j = open('msg.txt', 'r', encoding='UTF-8').read() hashtag = hash comment = com except: pass try: if msg.reply_to_message.text == "ارسل رمز حسابك 💚": pswd = x q.append(pswd) # open('msg.txt', 'a').write(x) # j = open('msg.txt', 'r').read() username = user password = pswd login_url = 'https://www.instagram.com/accounts/login/ajax/' login_headers = { 'accept': '*/*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'content-length': '275', 'content-type': 'application/x-www-form-urlencoded', 'cookie': 'ig_did=303991DA-0420-41AC-A26D-D9F27C8DF624; mid=X0padwAEAAEPS5xI4RZu1YV6z7zS; rur=ASH; csrftoken=xX0K5q7XikrU1LAnenqEVKqb7J3qK4S6; urlgen="{\"185.88.26.35\": 201031}:1kC1CG:D41DVXmf-j-T5nYho3c7g7K3MQU"', 'origin': 'https://www.instagram.com', 'referer': 'https://www.instagram.com/', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36', 'x-csrftoken': 'xX0K5q7XikrU1LAnenqEVKqb7J3qK4S6', 'x-ig-app-id': '936619743392459', 'x-ig-www-claim': 'hmac.AR3tv9HzzLkZIUlGMRu3lzHfEeePw9CgWg8cuXGO22LfU8x0', 'x-instagram-ajax': '0c15f4d7d44a', 'x-requested-with': 'XMLHttpRequest' } login_data = { 'username': f'{username}', 'enc_password': f'#PWD_INSTAGRAM_BROWSER:0:1589682409:{password}', 'queryParams': '{}', 'optIntoOneTap': 'false' } global login_to_acc login_to_acc = r1.post(login_url, data=login_data, headers=login_headers) if login_to_acc.content == b'{"user": false, "authenticated": false, "status": "ok"}': bot.send_message(msg.chat.id, 'تاكد من اليوزر ثم قم باعاده المحاوله 🌀') print("[!] Check Your Username And Try Again") elif login_to_acc.content == b'{"user": true, "authenticated": false, "status": "ok"}': bot.reply_to(msg, 'تاكد من الرمز الذي ادخلته ❗️') print("[!] Check Yo Password And Try Again") elif ('{"message": "checkpoint_required"') in login_to_acc.text: bot.reply_to( msg, 'قم بالتاكد من حسابك عن طريق دخول برنامج الانستا 🚸') elif 'userId' in login_to_acc.text: bot.send_message( msg.chat.id, 'تم تسجيل الدخول بنجاح\nارسل الهاشتاك المراد التفاعل به💟', reply_markup=markup) else: bot.reply_to(msg, 'هنالك خطا ❌') try: ig_did = login_to_acc.cookies['ds_user_id'] csrftoken = login_to_acc.cookies['csrftoken'] sessionid = login_to_acc.cookies['sessionid'] except: pass except: pass try: print(q) h = q.index(ch) url = f'https://www.instagram.com/explore/tags/{q[h + 3]}/?__a=1' x = r1.get(url).json() x = x['graphql']['hashtag']['edge_hashtag_to_media']['edges'] v = [] w = [] for i in x: global a, r a = len(v) r = len(w) if len(v) == 11: break else: url1 = f"https://www.instagram.com/web/comments/{i['node']['id']}/add/" head1 = { 'accept': '*/*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'content-length': '38', 'content-type': 'application/x-www-form-urlencoded', 'cookie': 'ig_did=EDC7FE1B-9EAA-4086-9FB9-CE9CC4891AA1; mid=X7-grwAEAAHIBy6aN0s2Pfinqt78; ig_nrcb=1; ds_user_id=43979535073; csrftoken=w8o85Yg3ZdvumwfPPTbUjX5KCouol1os; sessionid=43979535073%3AFCewAplGNTlIjG%3A17; shbid=19915; shbts=1607523548.4707706; rur=NAO; urlgen="{\"142.93.176.154\"', 'origin': 'https://www.instagram.com', 'referer': 'https://www.instagram.com/p/CIk_sHmFPOV/', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36', 'x-csrftoken': 'w8o85Yg3ZdvumwfPPTbUjX5KCouol1os', 'x-ig-app-id': '936619743392459', 'x-ig-www-claim': 'hmac.AR23xIF4vqkna9vUUPdTH-tcaUhsYyRw5KN7GvmcfVI0SrE0', 'x-instagram-ajax': '7e63b708ea25', 'x-requested-with': 'XMLHttpRequest' } data = {'comment_text': q[h + 4], 'replied_to_comment_id': ''} r1.post(url=url1, headers=head1, data=data) w.append(1) bot.edit_message_text( chat_id=ch, message_id=msg.message_id + 1, text=f'commont = {len(w)} \nlikes = {len(v)}\nfollow = 0') sleep(30) url = f"https://www.instagram.com/web/likes/{i['node']['id']}/like/" head = { 'accept': '*/*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'content-length': '0', 'content-type': 'application/x-www-form-urlencoded', 'cookie': 'ig_did=EDC7FE1B-9EAA-4086-9FB9-CE9CC4891AA1; mid=X7-grwAEAAHIBy6aN0s2Pfinqt78; ig_nrcb=1; ds_user_id=43979535073; csrftoken=w8o85Yg3ZdvumwfPPTbUjX5KCouol1os; sessionid=43979535073%3AFCewAplGNTlIjG%3A17; shbid=19915; shbts=1607523548.4707706; rur=NAO; urlgen="{\"142.93.176.154\": 14061}:1kn0Jy:HBU7WVbyf1Xn9AVcdiUGoEAwcts"', 'origin': 'https://www.instagram.com', 'referer': 'https://www.instagram.com/p/CIk_sHmFPOV/', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36', 'x-csrftoken': 'w8o85Yg3ZdvumwfPPTbUjX5KCouol1os', 'x-ig-app-id': '936619743392459', 'x-ig-www-claim': 'hmac.AR23xIF4vqkna9vUUPdTH-tcaUhsYyRw5KN7GvmcfVI0SrE0', 'x-instagram-ajax': '7e63b708ea25', 'x-requested-with': 'XMLHttpRequest' } r1.post(url=url, headers=head) v.append(1) bot.edit_message_text( chat_id=ch, message_id=msg.message_id + 1, text=f'commont = {len(w)} \nlikes = {len(v)}\nfollow = 0') sleep(20) except: pass try: head = { 'accept': '*/*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'content-length': '0', 'content-type': 'application/x-www-form-urlencoded', 'cookie': 'ig_did=EDC7FE1B-9EAA-4086-9FB9-CE9CC4891AA1; mid=X7-grwAEAAHIBy6aN0s2Pfinqt78; ig_nrcb=1; ds_user_id=43979535073; csrftoken=w8o85Yg3ZdvumwfPPTbUjX5KCouol1os; sessionid=43979535073%3AFCewAplGNTlIjG%3A17; shbid=19915; shbts=1607523548.4707706; rur=NAO; urlgen="{\"142.93.176.154\"', 'origin': 'https://www.instagram.com', 'referer': 'https://www.instagram.com/p/CIkoiB9AmNI/', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36', 'x-csrftoken': 'w8o85Yg3ZdvumwfPPTbUjX5KCouol1os', 'x-ig-app-id': '936619743392459', 'x-ig-www-claim': 'hmac.AR23xIF4vqkna9vUUPdTH-tcaUhsYyRw5KN7GvmcfVI0SrE0', 'x-instagram-ajax': '7e63b708ea25', 'x-requested-with': 'XMLHttpRequest' } try: url = 'https://www.instagram.com/web/friendships/1925510241/unfollow/' r1.post(url, headers=head) sleep(40) url = 'https://www.instagram.com/web/friendships/534649695/unfollow/' r1.post(url, headers=head) sleep(40) url = 'https://www.instagram.com/web/friendships/407474340/unfollow/' r1.post(url, headers=head) sleep(40) url = 'https://www.instagram.com/web/friendships/309511113/unfollow/' r1.post(url, headers=head) sleep(40) url = 'https://www.instagram.com/web/friendships/1782581874/unfollow/' r1.post(url, headers=head) sleep(40) except: pass sleep(50) try: url = 'https://www.instagram.com/web/friendships/1925510241/follow/' r1.post(url, headers=head) bot.edit_message_text( chat_id=ch, message_id=msg.message_id + 1, text=f'commont = {r} \nlikes = {a}\nfollow = 1') sleep(50) url = 'https://www.instagram.com/web/friendships/534649695/follow/' r1.post(url, headers=head) bot.edit_message_text( chat_id=ch, message_id=msg.message_id + 1, text=f'commont = {r} \nlikes = {a}\nfollow = 2') sleep(50) url = 'https://www.instagram.com/web/friendships/407474340/follow/' r1.post(url, headers=head) bot.edit_message_text( chat_id=ch, message_id=msg.message_id + 1, text=f'commont = {r} \nlikes = {a}\nfollow = 3') sleep(50) url = 'https://www.instagram.com/web/friendships/309511113/follow/' r1.post(url, headers=head) bot.edit_message_text( chat_id=ch, message_id=msg.message_id + 1, text=f'commont = {r} \nlikes = {a}\nfollow = 4') sleep(50) url = 'https://www.instagram.com/web/friendships/1782581874/follow/' r1.post(url, headers=head) bot.edit_message_text( chat_id=ch, message_id=msg.message_id + 1, text=f'commont = {r} \nlikes = {a}\nfollow = 5') j = types.InlineKeyboardMarkup() j1 = types.InlineKeyboardButton(f'اضغط لاعادة التفاعل 💚', callback_data='j1') j.add(j1) bot.send_message(ch, 'تم انهاء التفاعل بنجاح 💚', reply_markup=j) except: pass except: pass
def an(msg): try: if msg.text == 'الاعضاء' and msg.chat.id == idi: x = open('tran.txt', 'r').readlines() bot.reply_to(msg, '{}'.format(len(x))) except: pass try: if msg.text == 'الاذاعة' and msg.chat.id == idi: markup = types.ForceReply(selective=False) bot.send_message(msg.chat.id, "ارسل اذاعتك", reply_markup=markup) except: pass try: if msg.reply_to_message.text == "ارسل اذاعتك": s = msg.text x = open('tran.txt', 'r').readlines() z = 0 try: while z < len(x): if str(x[z]) == '\n': pass else: bot.send_message(x[z], s) z += 1 except: pass except: pass w = msg.text.lower() try: if msg.reply_to_message.text == "ارسل المصطلح الطبي المراد ترجمته": if w[0] == 'ا' or w[0] == 'أ' and w[1] == 'ل': url = f'https://context.reverso.net/translation/arabic-english/{w}' head = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.9', 'Connection': 'keep-alive', 'Cookie': 'didomi_token=eyJ1c2VyX2lkIjoiMTc1YWYxY2QtM2E4NS02NWNhLTlhNWYtNWMzMTMxYmY0OTQyIiwiY3JlYXRlZCI6IjIwMjAtMTEtMDlUMjI6MjU6MDMuODM3WiIsInVwZGF0ZWQiOiIyMDIwLTExLTA5VDIyOjI1OjAzLjgzN1oiLCJ2ZXJzaW9uIjpudWxsfQ==; __qca=P0-2069518181-1604960703577; _ga=GA1.2.1022455205.1604960704; _fbp=fb.1.1604960704785.1696161273; __gads=ID=6a415d82c09e7f2f:T=1604961014:S=ALNI_MYnjNMXo7nFRuuahoJIpqXamOQFvA; CTXTNODEID=bstweb12; experiment_context_N7gT3vKzX=0; JSESSIONID=kamXv4rTSPJG1mzG5D0fBsyY.bst-web12; context.lastpair=ar-en; history_entry=psycho]#[gastric]#[{w}; history_pair=en-ar]#[en-ar]#[ar-en; experiment_context_E3de3pqAZ=1; _gid=GA1.2.1607272187.1606403162; context.dapppromotion-count2=1; context.dapppromotion2=0; _gat_gtag_UA_2834324_41=1', 'Host': 'context.reverso.net', 'Referer': 'https://context.reverso.net/translation/arabic-english/%7Bw%7D', 'Sec-Fetch-Dest': 'document', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'same-origin', 'Sec-Fetch-User': '******', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' } j = r1.get(url=url, headers=head) v = (j.text[j.text.find( '<button class="other-content" data-other="0" data-negative="' ) + len( '<button class="other-content" data-other="0" data-negative="' ):j.text.find('Other translations</button>')])[:-2] c = (v.replace("-{", "").replace("}", "\n")) bot.send_message(msg.chat.id, f'* {c} *') else: try: if f'{w[0]}' in [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]: url = f'https://context.reverso.net/translation/arabic-english/{w}' head = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.9', 'Connection': 'keep-alive', 'Cookie': 'didomi_token=eyJ1c2VyX2lkIjoiMTc1YWYxY2QtM2E4NS02NWNhLTlhNWYtNWMzMTMxYmY0OTQyIiwiY3JlYXRlZCI6IjIwMjAtMTEtMDlUMjI6MjU6MDMuODM3WiIsInVwZGF0ZWQiOiIyMDIwLTExLTA5VDIyOjI1OjAzLjgzN1oiLCJ2ZXJzaW9uIjpudWxsfQ==; __qca=P0-2069518181-1604960703577; _ga=GA1.2.1022455205.1604960704; _fbp=fb.1.1604960704785.1696161273; __gads=ID=6a415d82c09e7f2f:T=1604961014:S=ALNI_MYnjNMXo7nFRuuahoJIpqXamOQFvA; CTXTNODEID=bstweb12; experiment_context_N7gT3vKzX=0; JSESSIONID=kamXv4rTSPJG1mzG5D0fBsyY.bst-web12; context.lastpair=ar-en; history_entry=psycho]#[gastric]#[{w}; history_pair=en-ar]#[en-ar]#[ar-en; experiment_context_E3de3pqAZ=1; _gid=GA1.2.1607272187.1606403162; context.dapppromotion-count2=1; context.dapppromotion2=0; _gat_gtag_UA_2834324_41=1', 'Host': 'context.reverso.net', 'Referer': 'https://context.reverso.net/translation/arabic-english/%7Bw%7D', 'Sec-Fetch-Dest': 'document', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'same-origin', 'Sec-Fetch-User': '******', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' } j = r1.get(url=url, headers=head) v = (j.text[j.text.find( '<button class="other-content" data-other="0" data-negative="' ) + len( '<button class="other-content" data-other="0" data-negative="' ):j.text.find('Other translations</button>')])[:-2] c = (v.replace("-{", "").replace("}", "\n")) bot.send_message(msg.chat.id, f'* {c} *') else: url = f'https://context.reverso.net/translation/arabic-english/{w}' head = { 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.9', 'Connection': 'keep-alive', 'Cookie': 'didomi_token=eyJ1c2VyX2lkIjoiMTc1YWYxY2QtM2E4NS02NWNhLTlhNWYtNWMzMTMxYmY0OTQyIiwiY3JlYXRlZCI6IjIwMjAtMTEtMDlUMjI6MjU6MDMuODM3WiIsInVwZGF0ZWQiOiIyMDIwLTExLTA5VDIyOjI1OjAzLjgzN1oiLCJ2ZXJzaW9uIjpudWxsfQ==; __qca=P0-2069518181-1604960703577; _ga=GA1.2.1022455205.1604960704; _fbp=fb.1.1604960704785.1696161273; __gads=ID=6a415d82c09e7f2f:T=1604961014:S=ALNI_MYnjNMXo7nFRuuahoJIpqXamOQFvA; CTXTNODEID=bstweb12; experiment_context_N7gT3vKzX=0; JSESSIONID=kamXv4rTSPJG1mzG5D0fBsyY.bst-web12; context.lastpair=ar-en; history_entry=psycho]#[gastric]#[{w}; history_pair=en-ar]#[en-ar]#[ar-en; experiment_context_E3de3pqAZ=1; _gid=GA1.2.1607272187.1606403162; context.dapppromotion-count2=1; context.dapppromotion2=0; _gat_gtag_UA_2834324_41=1', 'Host': 'context.reverso.net', 'Referer': 'https://context.reverso.net/translation/arabic-english/%7Bw%7D', 'Sec-Fetch-Dest': 'document', 'Sec-Fetch-Mode': 'navigate', 'Sec-Fetch-Site': 'same-origin', 'Sec-Fetch-User': '******', 'Upgrade-Insecure-Requests': '1', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.198 Safari/537.36' } j = r1.get(url=url, headers=head) v = (j.text[j.text.find( '<button class="other-content" data-other="0" data-negative="' ) + len( '<button class="other-content" data-other="0" data-negative="' ):j.text.find('Other translations</button>')])[:-2] c = (v.replace("-{", "").replace("}", "\n")) bot.send_message(msg.chat.id, f'* {c} *') except: pass except: pass if msg.reply_to_message: pass else: try: url = 'https://www.arabtran.com/gtranslate/' head = { 'accept': '*/*', 'accept-encoding': 'gzip, deflate, br', 'accept-language': 'en-US,en;q=0.9', 'content-length': '31', 'content-type': 'application/x-www-form-urlencoded; charset=UTF-8', 'cookie': '_ga=GA1.2.189101859.1607603223; _gid=GA1.2.154684385.1607603223; __gads=ID=ba2b5a0fe52a4c1b-22c3694088a60095:T=1607603223:RT=1607603223:S=ALNI_MbdZ0H2MeiuATaH2_vAl4hrUnPm8Q; _gat=1; sc_is_visitor_unique=rx12068393.1607603329.CA2EB2FDB25A4FB19C08D5DA0B092EBC.1.1.1.1.1.1.1.1.1', 'origin': 'https://www.arabtran.com', 'referer': 'https://www.arabtran.com/tarjamat_anjilizi_earabiun/', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36', 'x-requested-with': 'XMLHttpRequest', } q = types.InlineKeyboardMarkup() q1 = types.InlineKeyboardButton( 'اضغط هنا في حيال وجود مصطلح طبي 💟', callback_data='q1') q.add(q1) if f'{w[0]}' in [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ] or f'{w[1]}' in [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ] or f'{w[2]}' in [ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' ]: data = {'text': w, 'gfrom': 'en', 'gto': 'ar', 'key': 'ABC'} x = r1.post( url=url, data=data, ).text bot.send_message(msg.chat.id, x, reply_markup=q) else: data = {'text': w, 'gfrom': 'ar', 'gto': 'en', 'key': 'ABC'} x = r1.post( url=url, data=data, ).text bot.send_message(msg.chat.id, x, reply_markup=q) except: pass
#bot=telebot.AsyncTeleBot(API_TOKEN) #if you want your bot respond asynchronus options = { emojize(':dart:', use_aliases=True) + ' شروع آزمون ': 'Fight on', emojize(':trophy:', use_aliases=True) + ' امتیاز من ': 'My point' } markup = types.InlineKeyboardMarkup() for key, value in options.items(): markup.add( types.InlineKeyboardButton(text=key, callback_data="['value', '" + value + "', '" + key + "']")) markup.add( types.InlineKeyboardButton( text=emojize(':globe_with_meridians:', use_aliases=True) + ' وبسایت ', url="https://salamat.gov.ir")) mksighup = types.ForceReply(selective=False) markup2 = types.ReplyKeyboardMarkup(resize_keyboard=True) markup2.row(types.KeyboardButton(u"\u2160"), types.KeyboardButton(u"\u2161"), types.KeyboardButton(u"\u2162"), types.KeyboardButton(u"\u2163"), types.KeyboardButton(u"\u2164")) sighuplist = {} @bot.message_handler(commands=['end']) def surrend(message): try: redis.hset(message.from_user.username, 'state', 'finish') bot.reply_to(message, ' شانس خود را از دست دادی {}'.format( message.from_user.first_name), reply_markup=markup)
def add_anime(message: Message, bot): markup = types.ForceReply(selective=False) user_answer = bot.send_message(message.chat.id, 'Find title:', reply_markup=markup) bot.register_next_step_handler(user_answer, find_anime, bot=bot)
def set_name_cmd(message): bot.send_message(message.chat.id, config.set_name_text, reply_markup=types.ForceReply(selective=False)) bot.register_next_step_handler(message, set_name)
def CheckState(message): try: userid = str(message.from_user.id) chatid = str(message.chat.id) global quotes global texts if (userid in StateAdmin) and (StateAdmin[userid] != ''): if StateAdmin[userid] == '#SettingQuotes1#': StateAdminEnd[userid] = message.text if message.text == '-1': bot.reply_to(message, '已退出!') StateAdmin[userid] = '' return markup = types.ForceReply(selective=False) bot.send_message(chatid, '请输入您要定义的回复(输入-1终止):', reply_markup=markup) StateAdmin[userid] = '#SettingQuotes2#' return elif StateAdmin[userid] == '#SettingQuotes2#': if message.text == '-1': bot.reply_to(message, '已退出!') StateAdmin[userid] = '' return logging.info( str('Setting(Quotes):add::@{} ({} {}): {} -> {}'.format( message.from_user.username, message.from_user.first_name, message.from_user.last_name, StateAdminEnd[userid], message.text))) if StateAdminEnd[userid] in quotes: quotes[StateAdminEnd[userid]].append(message.text) else: quotes[StateAdminEnd[userid]] = [message.text] bot.reply_to( message, '定义:\n{} -> {}'.format(str(StateAdminEnd[userid]), str(message.text))) StateAdmin[userid] = '' SaveJson() bot.reply_to(message, '成功定义!') return else: if StateAdmin[userid] == '#SettingTexts#': if message.text == '-1': bot.reply_to(message, '已退出!') StateAdmin[userid] = '' return texts.append(message.text) logging.info( str('Setting(Texts):add::@{} ({} {}): {}'.format( message.from_user.username, message.from_user.first_name, message.from_user.last_name, message.text))) SaveJson() bot.reply_to(message, '成功定义!') return if StateAdmin[userid] == '#RemoveQuotes1#': if message.text == '-1': bot.reply_to(message, '已退出!') StateAdmin[userid] = '' return if message.text in quotes: StateAdminEnd[userid] = message.text markup = types.ForceReply(selective=False) bot.send_message(chatid, '请输入您要删除的回复(输入-1终止):', reply_markup=markup) StateAdmin[userid] = '#RemoveQuotes2#' return else: bot.send_message(chatid, '未找到对应的语段!\n请检查是否输入了多余的空格或引号!') StateAdmin[userid] = '' return elif StateAdmin[userid] == '#RemoveQuotes2#': if message.text == '-1': bot.reply_to(message, '已退出!') StateAdmin[userid] = '' return logging.info( str('Setting(Quotes):remove::@{} ({} {}): {} -> {}'. format(message.from_user.username, message.from_user.first_name, message.from_user.last_name, StateAdminEnd[userid], message.text))) quotes[StateAdminEnd[userid]].remove(message.text) bot.reply_to( message, '删除:\n{} -> {}'.format(str(StateAdminEnd[userid]), str(message.text))) StateAdmin[userid] = '' SaveJson() bot.reply_to(message, '成功删除!') return elif StateAdmin[userid] == '#RemoveTexts#': if message.text == '-1': bot.reply_to(message, '已退出!') StateAdmin[userid] = '' return bot.reply_to(message, '删除:\n{}'.format(str(message.text))) texts.remove(message) logging.info( str('Setting(Texts):remove::@{} ({} {}): {}'.format( message.from_user.username, message.from_user.first_name, message.from_user.last_name, message.text))) StateAdmin[userid] = '' SaveJson() bot.reply_to(message, '成功删除!') return elif StateAdmin[userid] == '#Settings1#': if message.text == '-1': bot.reply_to(message, '已退出!') StateAdmin[userid] = '' return if message.text == 'quotes': bot.reply_to(message, '请使用 /setquotes(/rmquotes) 编辑此项!') StateAdmin[userid] = '' return if message.text == 'quotes': bot.reply_to(message, '请使用 /settexts(/rmtexts) 编辑此项!') StateAdmin[userid] = '' return StateAdminEnd[userid] = message.text markup = types.ForceReply(selective=False) bot.send_message(chatid, '请输入该项您要编辑的内容(输入-1终止):', reply_markup=markup) StateAdmin[userid] = '#Settings2#' return elif StateAdmin[userid] == '#Settings2#': if message.text == '-1': bot.reply_to(message, '已退出!') StateAdmin[userid] = '' return markup = types.ForceReply(selective=False) logging.info( str('Setting:set::@{} ({} {}): {} -> {}'.format( message.from_user.username, message.from_user.first_name, message.from_user.last_name, StateAdminEnd[userid], message.text))) jsdata[StateAdminEnd[userid]] = message.text bot.reply_to( message, '设置:\n{} -> {}'.format(str(StateAdminEnd[userid]), str(message.text))) StateAdmin[userid] = '' SaveSetJson() bot.reply_to(message, '设置完成!') return except Exception as e: rid = getReportID() traceback.print_exc() logging.error( str(rid + '::' + str(repr(e)) + '\n' + traceback.format_exc()))
def promote_cmd(message): bot.send_message(message.chat.id, config.registration_text, reply_markup=types.ForceReply(selective=False)) logger.log_event(message.chat.id, 'Promote called') bot.register_next_step_handler(message, get_token)
def newtest(msg): cid = msg.chat.id markup = types.ForceReply(selective=False) sendto = bot.send_message(cid, "", reply_markup=markup) ques1id = sendto.message_id
def msg_add_match_team1(message): markup = types.ForceReply(selective=False) to_add[message.from_user.id]['Team1'] = message.text bot.send_message(message.chat.id, _('Team B name:'), reply_markup=markup) userStep[message.from_user.id] = 22
def makrup_paksa(): return types.ForceReply(selective=False)
def order(message): markup = types.ForceReply(selective=False) bot.send_message(message.chat.id, 'Введите столик заказа:', reply_markup=markup) step[message.chat.id] = 1
def send_something(message): markup = types.ForceReply(selective=False) msg = bot.send_message(message.from_user.id, "دوست من لطفا اسمتو برام بنویس و ارسال کن 😍🙏", reply_markup=markup) bot.register_next_step_handler(msg, process_name_step)
def send_welcome(message): bot.reply_to(message, "Hola!") markup = types.ForceReply(selective=False) msg = bot.send_message(message.chat.id, "Hola! Dime tu nombre!", reply_markup=markup) bot.register_next_step_handler(msg, get_name)
def mailwithsg(msg): cid = msg.chat.id if (cid in authedchat): bot.send_chat_action(cid, 'typing') mkup = types.ForceReply(selective=False) bot.send_message(cid, "EACH MSG MUST START WITH **mail_**", parse_mode='Markdown') ask_frommsg = bot.send_message( cid, 'From which account? Fill in your username, start with mail_from:', reply_markup=mkup) msginitid = ask_frommsg.message_id if (msg.reply_to_message.message_id == msginitid): addr_fromm = str(msg.text) addr_fromm = addr_fromm.replace('mail_from:', '') + str("@ynu.edu.pl") mail_details['from'] = addr_fromm ask_tomsg = bot.send_message( cid, "Send to? reply must start with mail_to:", reply_markup=mkup) ask_tomsgid = ask_tomsg.message_id elif (msg.reply_to_message.message_id == ask_tomsgid): addr_to = str(msg.text) addr_to = addr_to.replace('mail_to:', '') mail_details['to'] = addr_to ask_submsg = bot.send_message( cid, "Subject? reply must start with mail_subject:", reply_markup=mkup) ask_submsgid = ask_submsg.message_id elif (msg.reply_to_message.message_id == ask_submsgid): mail_sub = str(msg.text) mail_sub = mail_sub.replace('mail_subject:', '') mail_details['subject'] = mail_sub ask_msgtext = bot.send_message( cid, "Content? reply must start with mail_cont:", reply_markup=mkup) ask_msgtextid = ask_msgtext.message_id elif (msg.reply_to_message.message_id == ask_msgtextid): mail_conc = str(msg.text) mail_conc = mail_conc.replace('mail_cont:', '') mail_details['plaintext'] = mail_conc ask_atthconfirm = bot.send_message( cid, "Do you have attachment? mail_Y/mail_N ", reply_markup=mkup) ask_atthconfirmid = ask_atthconfirm.message_id elif (msg.reply_to_message.message_id == ask_atthconfirmid): atth_conf = str(msg.text) atth_conf = atth_conf.replace('mail_', '') if atth_conf == 'Y': bot.send_message( cid, "Please send your attachment (1 File Only, must <7MiB, time out:30s)" ) time.sleep(32) mail_details['atth'] = True mail_details['atthname'] = file_name mail_details['atthmime'] = file_mime if atth_conf == 'N': mail_details['atth'] = False bot.send_chat_action(cid, 'typing') bot.send_message(cid, "Done!") bot.send_message(cid, "Send /finalsend to send your mail.") else: pass
import urllib3 reload(sys) import requests import json import pymongo from pymongo import MongoClient administrador = [11186174] admin = [4891212, 11186174] TOKEN = '180904359:AAHR0sl_cjv9bREgCjKWVJ_kNpd3MN14T5E' usuarios = [line.rstrip('\n') for line in open('usuarios.txt')] # Cargamos la lista de usuarios. numeros = [line.rstrip('\n') for line in open('numeros.txt')] # Cargamos la lista de usuarios. bot = telebot.TeleBot('180904359:AAHR0sl_cjv9bREgCjKWVJ_kNpd3MN14T5E') markup = types.ForceReply(selective=False) userStep = dict() encuesta = { 'encuesta': '', 'respuestas': [], } votaciones = {} def listener(messages): for m in messages: cid = m.chat.id if m.content_type == 'text': if m.text.lower() == '/sistemas tontopoia': bot.send_message(
def get_user_step(uid): if uid in userStep: return userStep[uid] else: knownUsers.append(uid) userStep[uid] = 0 print("New user detected, who hasn't used \"/start\" yet") return 0 imageSelect = types.ReplyKeyboardMarkup(one_time_keyboard=True) imageSelect.add('shaq-crying', "bhagwaan-hai") # baap ko mat sikha , avoid hideBoard = types.ReplyKeyboardRemove() lineSelect = types.ForceReply(selective=False) # @bot.message_handler(commands=['start']) def command_start(m): cid = m.chat.id if cid not in knownUsers: # if user hasn't used the "/start" command yet: # save user id, so you could brodcast messages to all users of this bot later knownUsers.append(cid) # save user id and his current "command level", so he can use the "/getImage" command userStep[cid] = 0 bot.send_message( cid, "Hi,some useful commands for you,try not to spam the bot with random commands it tends to slow things down" )
def add_sticker_handler(message): bot.send_message(message.chat.id, "теперь отправь мне стикер", reply_markup=types.ForceReply())
def zapros_medicine(message): if message.chat.id in config.adminid: keyboard0 = types.ForceReply(selective=True) bot.send_message(message.chat.id, 'Добавить лекарство?', reply_markup=keyboard0)