def button_diskra_handler(update: Update, context: CallbackContext): update.message.reply_text( text='Дискра. "Это я не рассказываю в этом курсе" by Гашков ', reply_markup=ReplyKeyboardRemove(), )
def cancelar_borrar_busqueda(self, update, context): update.message.reply_text( 'Borrado de búsqueda cancelado.', reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END
def start_add_gif(update: Update, context: CallbackContext): context.user_data.clear() chat_id = update.message.from_user.id context.bot.send_message(chat_id, 'Send your Gif!', reply_markup=ReplyKeyboardRemove()) return GIF
def got_location(bot, update, user_data): chat_id = update.message.chat_id bot.send_message(chat_id=chat_id, text="Ok! Searching gas stations...", reply_markup=ReplyKeyboardRemove()) loc = update.message.location return setdata(bot, update, loc, user_data)
def error(update, context): update.message.reply_text( "Sorry, there is something wrong with your input. Please try again!", reply_markup=ReplyKeyboardRemove()) """Log Errors caused by Updates.""" logger.warning('Update "%s" caused error "%s"', update, context.error)
def handler_timeout(update: Update, context: CallbackContext): bot.send_message(chat_id=update.message.from_user.id, text=text_timeout(), reply_markup=ReplyKeyboardRemove())
def cancel(update, context): update.message.reply_text('Bye! I hope we can talk again some day.', reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END
def button_menu_handler(update: Update, context: CallbackContext): update.message.reply_text( text='Последние новости: скоро будет телеграм-бот!', reply_markup=ReplyKeyboardRemove(), )
def button_subs_handler(update: Update, context: CallbackContext): update.message.reply_text( text= 'Введи название предмета/фамилию препода. Если хочешь узнать общую информацию о предметах напиши "инфа" (без кавычек, разумеется)', reply_markup=ReplyKeyboardRemove(), )
def button_help_handler(update: Update, context: CallbackContext): update.message.reply_text( text= 'Я бот-мизантроп. Справься как-нибудь сам со своей проблемой! Еще можешь написать @mary_v_q или Кате Новицкой(самой лучшей старосте во вселенной). Что-то еще нужно?', reply_markup=ReplyKeyboardRemove(), )
def message_handler(update: Update, context: CallbackContext): text = update.message.text if text == button_help: return button_help_handler(update=update, context=context) if text == 'Инфа' or text == 'инфа': return button_inf_handler(update=update, context=context) if text == 'Нет' or text == 'нет' or text == 'no' or text == 'nope': update.message.reply_text( text= 'Что нет? Если больше ничего не нужно, то пока! Удачи на сессии!)', reply_markup=ReplyKeyboardRemove(), ) return text if text == 'Ор' or text == 'Лол' or text == 'ахахах' or text == 'Ахах': update.message.reply_text( text=')))))))))))', reply_markup=ReplyKeyboardRemove(), ) return text if text == 'Ок' or text == 'ok' or text == 'ок' or text == 'ok': update.message.reply_text( text='Ну ок и ок', reply_markup=ReplyKeyboardRemove(), ) return text if text == 'Дифгем' or text == 'Диффгем': update.message.reply_text( text='Дифгем, дифгем, дифгемчик. Эх, к сожалению, он закончился(. ', reply_markup=ReplyKeyboardRemove(), ) return text if text == 'Матстат': update.message.reply_text( text= 'Молодец, что решил позаниматься! Где-то радуется Родионов! А что именно: лекции, семинары? (Набери "Матстат семинары" или "матстат лекции")', reply_markup=ReplyKeyboardRemove(), ) return text if text == 'Матстат семинары' or text == 'Муромская' or text == 'матстат семинары' or text == 'мирера' or text == 'Мирера': return button_muromskaya_handler(update=update, context=context) if text == 'Матстат лекции' or text == 'Родионов' or text == 'матстат лекции': return button_rodionov_handler(update=update, context=context) if text == 'Алгебра' or text == 'Артамонов' or text == 'Артамон' or text == 'артамонов' or text == 'артамон' or text == 'алгебра': return button_algebra_handler(update=update, context=context) if text == 'УРЧП' or text == 'Капустина' or text == 'Урчп' or text == 'капустина' or text == 'урчп': return button_urchp_handler(update=update, context=context) if text == 'Дискра' or text == 'Гашков' or text == 'гашков' or text == 'дискра': return button_diskra_handler(update=update, context=context) if text == 'Актуарка' or text == 'Гнеденко' or text == 'гнеденко' or text == 'актуарка': return button_death_handler(update=update, context=context) if text == 'Русский' or text == 'Кислова' or text == 'русский' or text == 'русичка': return button_russ_handler(update=update, context=context) if text == 'Финансовая' or text == 'Финмат' or text == 'Жулик' or text == 'Жуленев': return button_finmath_handler(update=update, context=context) if text == button_menu: return button_menu_handler(update=update, context=context) if text == button_subs: return button_subs_handler(update=update, context=context) reply_markup = ReplyKeyboardMarkup( keyboard=[ [ KeyboardButton(text=button_help), KeyboardButton(text=button_menu), KeyboardButton(text=button_subs), ], ], resize_keyboard=True, ) update.message.reply_text( text='Выбери кнопку ниже!', reply_markup=reply_markup, )
def button_russ_handler(update: Update, context: CallbackContext): update.message.reply_text( text='Русский', reply_markup=ReplyKeyboardRemove(), )
def button_finmath_handler(update: Update, context: CallbackContext): update.message.reply_text( text= 'Финансовая математика. \n 1) Читайте главы книги. Жуленев ЖДЕТ вопросы от нас. \n 2) Попросил собирать вопросы кучей и кому-то одному задавать их ему по телефону. ', reply_markup=ReplyKeyboardRemove(), )
def button_death_handler(update: Update, context: CallbackContext): update.message.reply_text( text='Актуарка. Объявляется конкурс на смешные шутки', reply_markup=ReplyKeyboardRemove(), )
def reply_keyboard_remove(): return ReplyKeyboardRemove(selective=TestReplyKeyboardRemove.selective)
def button_inf_handler(update: Update, context: CallbackContext): update.message.reply_text( text='Здесь будет общая информация по предметам. Что как где куда.', reply_markup=ReplyKeyboardRemove(), )
def cancel(update, context): user = update.message.from_user update.message.reply_text('Canceled.', reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END
def button_rodionov_handler(update: Update, context: CallbackContext): update.message.reply_text( text= 'Математическая статистика. Лекции.\n Занятия в онлайн-формате Родионов проводить не будет, потому что по четвергам (нам, соответственно, лекции будут попадать после) проводит точно такие же лекции в ШАДе и большой разницы между просмотром в Ютубе и лекцией онлайн не будет.\n Если возникают вопросы по ходу лекции – пишите их мне, буду отсылать ему на почту кучей. \n 2) Смотрите файлы MSPS_2020_1.pdf, MSPS_2020_2.pdf, MSPS_2020_3.pdf, MSPS_2020_4_1.pdf, MSPS_2020_4_2.pdf, MSPS_2020_5.pdf, MSPS_2020_6.pdf, MSPS_2020_7.pdf \n 3) Плейлист с лекциями: https://www.youtube.com/playlist?list=PLs-BvBCvcJRXXaS64uJOgx6G8t7kTE_x', reply_markup=ReplyKeyboardRemove(), )
def exit_point(update: Update, context: CallbackContext): bot.send_message(chat_id=update.message.from_user.id, text=text_exit_point(), reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END
def button_muromskaya_handler(update: Update, context: CallbackContext): update.message.reply_text( text='Математическая статистика. Семинары.', reply_markup=ReplyKeyboardRemove(), )
def cancel(update, context): user = update.message.from_user logger.info("User %s canceled the conversation.", user.first_name) update.message.reply_text('Bye! I hope we can talk again some day.', reply_markup=ReplyKeyboardRemove())
def button_algebra_handler(update: Update, context: CallbackContext): update.message.reply_text( text= 'Алгебра. "Попозже отправлю, пораньше сделают"\n Домашние задания он проверяет и просит присылать себе на почту. Кидаете мне – я скидываю общим архивом. \n 2) Домашнее задание на 17.04.2020: «Теория - задача распределения кредита - лекции раздел 2.2, стр.39 - 46. Здесь изложена постановка задачи и алгоритм. Упражнения. а) Задания 3.4 (1,2) на стр. 53.б) В лекции алгоритм приведен без обоснования. Последняя задача - обосновать алгоритм из лекций». \n 3) Дедлайн: пятница17.04.2020 в 17:00 отсылаю архив. \n 4) Файл с материалами и задачами vavt19a.pdf.', reply_markup=ReplyKeyboardRemove(), )
def credits(update, context): update.message.reply_text( "Yay! Hope this helped you throughout! We will be coming up with one more upcoming bot soon! ", reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END
def button_urchp_handler(update: Update, context: CallbackContext): update.message.reply_text( text='УРЧП', reply_markup=ReplyKeyboardRemove(), )
def anketa_start(update, context): update.message.reply_text('Привет, как вас зовут?', reply_markup=ReplyKeyboardRemove()) return 'name'
def cancel(update: Update, context: CallbackContext): user = update.message.from_user logger.info("User %s canceled", user.first_name) update.message.reply_text('Canceled', reply_markup=ReplyKeyboardRemove()) return ConversationHandler.END
def Cek_MYIR(update, context): # user = update.message.from_user # try: data_ = str(get_myir(update.message.text).text) json_ = json.loads(data_) data={} if json_['data'] == None: update.message.reply_text('MYIR tidak ditemukan, Masukkan Nomor MYIR lagi :',reply_markup=ReplyKeyboardRemove()) return CEK_MYIR else : conn = connection() cursor = conn.cursor() cursor.execute("select foto_rumah_pelanggan,tag_lokasi_pelanggan from valdat_sales where track_id = '"+str(update.message.text)+"'") if cursor.fetchone() != None: foto_rumah_pelanggan,tag_lokasi_pelanggan = cursor.fetchone() data_json = json_['data'] data['TRACK ID'] = data_json['track_id'] data['K-CONTACT'] = json_['data']['detail'][0]['x3'] data['NO SC'] = "-" if data_json['scid'] is None else data_json['scid'] data['TANGGAL ORDER'] = "-" if data_json['orderDate'] is None else data_json['scid'] data['STATUS MYIR'] = data_json['status_name'] data['NAMA CUSTOMER'] = data_json['user_name'] data['PAKET'] = data_json['name'] data['ALAMAT INSTALASI'] = json_['data']['address']['address'] data['STO'] = json_['data']['data1']['sto'] update.message.reply_text( "TRACK ID : "+data['TRACK ID']+ "\nK_CONTACT : "+data['K-CONTACT']+ "\nNO_SC : "+data['NO SC']+ "\nTANGGAL_ORDER : "+data['TANGGAL ORDER']+ "\nSTATUS : "+data['STATUS MYIR']+ "\nNAMA_CUSTOMER : "+data['NAMA CUSTOMER']+ "\nPAKET : "+data['PAKET']+ "\nALAMAT_INSTALASI : "+data['ALAMAT INSTALASI']+ "\nSTO : "+data['STO'] # "\n foto_rumah_pelanggan : "+foto_rumah_pelanggan+ # "\n tag_lokasi_pelanggan : "+tag_lokasi_pelanggan ) update.message.reply_text("berikut foto rumah pelanggan") context.bot.send_photo(chat_id=update.message.chat_id,photo=open(str(foto_rumah_pelanggan),'rb')) update.message.reply_text("berikut lokasi rumah pelangan") loc = tag_lokasi_pelanggan.split(',') urllib.request.urlopen("https://api.telegram.org/bot"+str(TOKEN)+"/sendlocation?chat_id="+str(update.message.chat_id)+"&latitude="+str(loc[0].strip())+"&longitude="+str(loc[1].strip())).read() return ConversationHandler.END else: update.message.reply_text("belum ada foto rumah pelanggan dan tangging lokasi pelanggan dari sales") return CEK_SC
def create_listener(update: Update, context: CallbackContext): update.message.reply_text(text=f"Please enter Description or /cancel", reply_markup=ReplyKeyboardRemove()) return ENTER_DESCRIPTION
def voice_handler(bot, update): update.message.reply_text( emojize("Très jolie voix ! Mais je ne comprend pas encore la parole :cry:.", use_aliases=True), reply_markup=ReplyKeyboardRemove())
def handler_timeout(update: Update, context: CallbackContext): user_id = context.effective_user['id'] bot.send_message(chat_id=user_id, text=text_timeout(), reply_markup=ReplyKeyboardRemove(), parse_mode=telegram.ParseMode.HTML)