def __init__(self, token): super().__init__(token, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, TheManager, timeout=10), ]) self.spotify_controller = SpotifyController(self) self.game_controller = LyricGameController(self)
def main(loggingfile, TOKEN): logging.basicConfig(filename=loggingfile + '.log', format='%(asctime)-15s %(message)s') bot = telepot.DelegatorBot(TOKEN, [ pave_event_space()( per_inline_from_id(), create_open, InlineHandler, timeout=1), include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, MessageHandler, timeout=1) ]) bot.message_loop(run_forever='Listening ...')
def __init__(self,token): self.adminconfig() self.timeconfig() x.loadConfig() config1.read('telebot.ini') idadmin = config1.get('admin','chatid') x.camStart() super(ChatBox, self).__init__(token, [ include_callback_query_chat_id(pave_event_space())(per_chat_id_in([int(idadmin)],types='private'), create_open, SmartRoomChat, timeout=90), pave_event_space()(per_chat_id_except([int(idadmin)],types='private'), create_open, NonAdmin, timeout=10), ])
def __init__(self, token, members, polls, students): self._polls = polls self._members = members self._students = students super(Congress, self).__init__(token, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(types=['private']), create_open, Member, self._polls, self._members, self._students, timeout=20), ])
def main(): global bot, authorized_users, verbose, scheduler, owm, owm_api_key, city_list config_filename = 'weatherbot-config.json' try: with open(config_filename, 'r') as config_file: config = json.load(config_file) except FileNotFoundError: print('Error: config file "{}" not found: {}'.format(config_filename)) return except ValueError as e: print('Error: invalid config file "{}": {}'.format(config_filename, e)) return telegram_bot_token = config.get('telegram_bot_token') if not telegram_bot_token: print('Error: config file doesn’t contain a `telegram_bot_token`') return authorized_users = config.get('authorized_users') if type(authorized_users) is not list or len(authorized_users) == 0: print('Error: config file doesn’t contain an `authorized_users` list') return verbose = config.get('verbose', True) owm_api_key = config.get('openweathermap', {}).get('api_key') owm = OpenWeatherMap(owm_api_key) if owm_api_key else None city_list_filename = config.get('openweathermap', {}).get('city_list') city_list = CityList() if city_list_filename: city_list.read( city_list_filename, lambda p: print( '\rLoading city list ... {:d}%'.format(p), end='', flush=True)) print() bot = telepot.DelegatorBot(telegram_bot_token, [ include_callback_query_chat_id(pave_event_space())(per_chat_id_in( authorized_users, types='private'), create_open, ChatUser, timeout=3600) ]) scheduler.start() try: bot.message_loop(run_forever='Bot listening ...') except KeyboardInterrupt: pass if verbose: print('Exiting ...') scheduler.shutdown()
def run_bot(token, config): files_tree_generators= {} for shared_directories in config.values(): for sd in shared_directories: if sd.path not in files_tree_generators: files_tree_generators[sd.path] = nav.FilesTreeGenerator(sd.path) global global_config global_config = config global global_files_tree_generators global_files_tree_generators = files_tree_generators bot = telepot.DelegatorBot(token, [ include_callback_query_chat_id( pave_event_space())( per_chat_id(types=['private']), create_open, NavigatorBot, timeout=300), ]) MessageLoop(bot).run_as_thread() logging.info("Listening started") print('Listening ...') while 1: time.sleep(10)
def main(): if not BOT_TOKEN: print(BOT_TOKEN_NOT_FOUND_MESSAGE) sys.exit(1) try: bootstrap_database() bot = telepot.DelegatorBot(BOT_TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(types=['private']), create_open, MessageHandler, timeout=10), ]) urls = UrlsHistory.select().order_by('-created_at') bot.message_loop(run_forever='At your service. ' 'There are {} urls ' 'on the history.'.format(urls.count())) except KeyboardInterrupt: print('Finishing by your request. Bye!\n') sys.exit(0)
"Thanks for your query, our admins will respond back soon. In mean time, please do check out [FAQ](https://auxledger.org/#faq) section on our homepage.", reply_to_message_id=i['message_id'], parse_mode='Markdown') db_message_collection.find_one_and_update( { 'chat_id': chat_id, 'message_id': i['message_id'] }, {'$set': { 'msg_flag': False }}) time.sleep(120) else: pass bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(types=['group']), create_open, AuxEChat, timeout=200), ]) def main(): MessageLoop(bot).run_as_thread() sched.start() while 1: time.sleep(15) if __name__ == '__main__': main()
def __init__(self, token): super(Bot, self).__init__(token, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, ChatHandler, timeout=120) ])
bot.sendMessage( chat_id, "You can choose to change status to one of the following actuators: ", reply_markup=keyboard ) bot.sendMessage(chat_id, "Click here to reload the rooms ---> /start") else: response = requests.post(query_data) actuator_status = json.loads(response.content) bot.sendMessage(chat_id, "Status of the selected actuator is now: "+actuator_status["Response"]) if __name__ == "__main__": TOKEN = "1003608093:AAEgixlk1gP2F4ldLWQl6J512T_R0h-Wn7k" bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id( pave_event_space())( per_chat_id(), create_open, TelegramBot, timeout=200), ]) """bot = telepot.DelegatorBot(TOKEN, [ pave_event_space()( per_chat_id(), create_open, TelegramBot, timeout=200), pave_event_space()( per_callback_query_origin(), create_open, TelegramBot, timeout=200) ])""" MessageLoop(bot).run_as_thread() print("Listening...") while 1: time.sleep(10)
# Parser de los argumentos de /start def get_cuartico_data(entrada): entrada_list = entrada.split(' ') if not (len(entrada_list) in [2, 4]): return False ret = [] for e in entrada_list: ret.append(e) for i in range(len(e) - 3): e.append(None) return ret if __name__ == '__main__': TOKEN = os.environ.get('TOKEN') bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, ChatSesion, timeout=3600), ]) MessageLoop(bot).run_as_thread() print('Listening...') #keep the program running while 1: time.sleep(10)
str(sqliter.Words.WORDS_LIST[Foo.count[str( msg['from']['id'])]]).strip("()'',")) else: bot.sendMessage( chat_id, "Подождите пока загрузим новые слова!\n Потом снова нашмите на кнопку" ) elif int(query_data) in age_list: write_db( Foo.CONST_NAME[msg['from']['id']]['from']['id'], f'/home/pc/PycharmProjects/tgbot/files/{Foo.CONST_NAME[msg["from"]["id"]]["from"]["id"]}', query_data, Foo.gender[msg['from']['id']], Foo.CONST_NAME[msg['from']['id']]['from']['first_name']) bot.editMessageText(( msg['from']['id'], msg['message']['message_id'] ), "Регистрация прошла успешно \n Нажмите на слэш '/' и выберите exercise чтобы начать упражнения \n После того как выйдет текст запишите аудио" ) bot = telepot.DelegatorBot("1079116810:AAFKRqfx1XQhj6wG5jDifUUiHWsjtNpEpA4", [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, Voice, timeout=90) ]) MessageLoop(bot).run_as_thread() answerer = telepot.helper.Answerer(bot) print('Listening ...') while 1: time.sleep(10)
logging.debug("New cookie dictionary created") def dump_cookies(self): fileurl = f"../../data/cookies/{self.chatid}.json" logging.debug(f"Cookie file path (dump): {fileurl}") try: with open(fileurl, "w") as f: json.dump(self.cookies, f, indent=4) logging.debug("dumped cookie. no errors.") except FileNotFoundError: logging.error("Error dumping Cookie!, #0003") self.sender.sendMessage("Fehler #0003") bot = telepot.DelegatorBot(API_KEY, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, MessageHandler, timeout=60), ]) def reload_service(): if platform.system() == "Linux": subprocess.run(["sudo", "service", "kiosk.sh", "restart"]) # noinspection PyBroadException try: MessageLoop(bot).run_as_thread() # Define Scheduled Jobs # noinspection PyBroadException try:
if self.currentCategory != len(self.categories): self.votes.append({ str(self.categories[self.currentCategory]): self.candidates[self.currentCategory][int(query_data) - 1] }) if self.currentCategory != len(self.categories) - 1: bot.sendMessage(from_id, 'Dale a /siguiente') if self.currentCategory == len(self.categories) - 1: bot.sendMessage(from_id, 'Gracias por tu participación') with open(str(self.voter), 'w') as f: json.dump(self.votes, f) self.currentCategory += 1 bot.answerCallbackQuery(query_id, text='Respuesta registrada') TOKEN = sys.argv[1] # get token from command-line bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, MessageCounter, timeout=1000), ]) MessageLoop(bot).run_as_thread() print('Listening ...') while True: time.sleep(10)
else: self.bot.answerCallbackQuery( query_id, text='Ok. Tapi aku akan terus bertanya.') self._cancel_last() self._propose() def on__idle(self, event): self.sender.sendMessage( 'Saya tahu Anda mungkin perlu sedikit waktu. Aku akan selalu di sini untukmu.' ) self._cancel_last() self.close() def on_close(self, ex): # Save to database global propose_records propose_records[self.id] = (self._edit_msg_ident) TOKEN = '1202817061:AAHLFAFoftMnaOenIt59XG_IzGIp8a7yM2M' bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(types=['private']), create_open, Lover, timeout=10), ]) MessageLoop(bot).run_as_thread() print('Listening ...') while 1: time.sleep(10)
elif query_data == 'aiuto_no': self._cancel_last() self.sender.sendMessage('Mi dispiace. Puoi provare a riformulare la domanda o contattare il seguente recapito: XXX.') self.close() # def on__idle(self, event): # self._count += 1 # sent = self.sender.sendMessage('Ti ho aiutato?',reply_markup=InlineKeyboardMarkup(inline_keyboard=[[InlineKeyboardButton(text='Si', callback_data='aiuto_si'),InlineKeyboardButton(text='No', callback_data='aiuto_no')]])) # self._editor = telepot.helper.Editor(self.bot, sent) # self._edit_msg_ident = telepot.message_identifier(sent) # def on_close(self, ex): # global propose_records # propose_records[self.id] = (self._count, self._edit_msg_ident) TOKEN = '588907997:AAHDaBq3DEpTyqEfJaSqdQTJw4-xgLO4Aaw' TIMEOUT = 1000 bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id( pave_event_space())( per_chat_id(types=['private']), create_open, Bebot, timeout=TIMEOUT), ]) MessageLoop(bot).run_as_thread() print('Listening ...') while 1: time.sleep(TIMEOUT)
result = self._count_votes() self._close_ballot() self.sender.sendMessage('Time is up:\nYes: %d\nNo: %d\nSilent: %d' % result) def on_close(self, ex): global votes if self._ballot_box is None: try: del votes[self.id] except KeyError: pass else: votes[self.id] = (self._ballot_box, self._keyboard_msg_ident, self._expired_event) from pprint import pprint pprint(votes) TOKEN = sys.argv[1] bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id( pave_event_space())( per_chat_id(types=['group']), create_open, VoteCounter, timeout=10), ]) MessageLoop(bot).run_as_thread() print('Listening ...') while 1: time.sleep(10)
if self._editor: self._editor.editMessageReplyMarkup(reply_markup=None) self._editor = None self._edit_msg_ident = None def on_chat_message(self, msg): content_type, _, _ = telepot.glance(msg) if content_type == 'text': self._handle_message(msg) def on__idle(self, event): self.sender.sendMessage('Tempo esgotado!') self.close() def on_close(self, ex): global propose_records bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(types=['private']), create_open, EDPBR_HelperBot, timeout=300), ]) MessageLoop(bot).run_as_thread() print('Listening ...') while True: time.sleep(300)
self._state_input = 'addservice_migrasi_modifikasi' elif query_data == 'addservice': self._cancel_markup() self._send_message('Masukkan nomor pelanggan.') self._state_input = 'addservice' elif query_data == 'unbind': unbind = db.unbind(from_id) self._send_message('Unbind berhasil.', self.daftar_keyboard) self._state = '' # TOKEN = sys.argv[1] # get token from command-line if sys.version[0] == '3': # @developmentdamanbot TOKEN = '694699130:AAG4S3Tb9uxxxPHjbl5fP-QiNsjOehOhieM' else: # @haeventbot TOKEN = '692089019:AAHR_d7I0VRer2BELku90RHlzP6m7fp14DY' bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, HadirEvent, timeout=500), ]) MessageLoop(bot).run_as_thread() print('Listening ...') while 1: time.sleep(10)
#ADMIN --------------------------------------------------------------------------- def handleAdmin(self, command, msg, chat_id): print(unicode('ADMIN MODE:-------- ')) adminHandler.handleAdmin(command, msg, chat_id, bot) #NORMAL USER ------------------------------------------------------------------------ def handleUser(self, command, msg, chat_id): userHandler.handleUser(command, msg, chat_id, bot) # Runs once ----------------------------------------------------------------------------------------------------------- # Initialize bot bot = telepot.DelegatorBot(customConfig.token, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, FutureBot, timeout=180), ]) # On first startup, inform all registered users of update mydb = SQLight(config.database_name) player = mydb.get_player() for p in player: p_id = p[1] print(u'Send message to: ' + unicode(p[2]) + u' ID: ' + unicode(p[1])) try: bot.sendMessage(p_id, 'UPDATED VERSION AVAILABLE') except Exception as e: print(u'Unavailable group or user') mydb.close() # Start message loop
self._game_phase = 1 keyboard = InlineKeyboardMarkup(inline_keyboard=[ [ InlineKeyboardButton(text='Roll ' + self._emoticons['die'], callback_data='roll') ], ]) self.sender.sendMessage('New Round? ' + self._emoticons['grin'], reply_markup=keyboard) elif int(query_data) > 0 and int(query_data) < 7: if int(query_data) in self._p_hand: self._p_hand.remove(int(query_data)) self.sender.sendMessage('Choses dice to re-roll', reply_markup=self._rerollKeyboard( self._p_hand, self._emoticons)) def on__idle(self, event): self.sender.sendMessage('Game expired. ' + self._emoticons['sweat']) self.close() TOKEN = sys.argv[1] bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, Player, timeout=6000), ]) bot.message_loop(run_forever='Listening ...')
self._cancel_last() self.sender.sendMessage('Thank you!') self.close() else: self.bot.answerCallbackQuery(query_id, text='Ok. But I am going to keep asking.') self._cancel_last() self._propose() def on__idle(self, event): self.sender.sendMessage('I know you may need a little time. I will always be here for you.') self.close() def on_close(self, ex): # Save to database global propose_records propose_records[self.id] = (self._count, self._edit_msg_ident) TOKEN = sys.argv[1] bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id( pave_event_space())( per_chat_id(types=['private']), create_open, Lover, timeout=10), ]) MessageLoop(bot).run_as_thread() print('Listening ...') while 1: time.sleep(10)
self._buy_or_not = True self._buy_info_flag = False if query_data == 'buy_book_no': keyboard = InlineKeyboardMarkup( inline_keyboard=[[ InlineKeyboardButton(text='Yes', callback_data='search_other_book_yes') ], [ InlineKeyboardButton( text='No', callback_data='search_other_book_no') ]]) bot.sendMessage(from_id, 'Do you wanna search for other books', reply_markup=keyboard) TOKEN = '430811551:AAEUJoN6B8hajtfHi2q9sz8gBYvlh3JjGuo' bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, ChatHandler, timeout=1000000000000000000), ]) bot.deleteWebhook() MessageLoop(bot).run_as_thread() print('Listening ...') while 1: time.sleep(10)
def on_callback_query(self, msg): query_id, from_id, query_data = telepot.glance(msg, flavor='callback_query') if query_data == 'enable': ads_block_status = ChangeEnableAds(True) else: ads_block_status = ChangeEnableAds(False) self.bot.answerCallbackQuery(query_id, text="AdBlock %s" % ads_block_status) isNotConn = True logging.basicConfig(filename="ChannelControllerBot.log", level=logging.INFO) while isNotConn: try: bot = telepot.DelegatorBot( config.bot_token, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(), create_open, Bot, timeout=900), #15 min ]) MessageLoop(bot).run_as_thread() isNotConn = False except Exception as e: logging.error(str(e)) time.sleep(10) while 1: time.sleep(10)
return None else: bot.sendMessage(chat_id, errorMsg) def on_callback_query(self, msg): ##query data """find out which quiz the person last did. per_chat_id stores the quizzes the person last did""" query_id, from_id, query_data = telepot.glance(msg, flavor='callback_query') print('Response:', query_id, from_id, query_data) oncallbackobject=updated_gspread() quizno=query_data[:3] ##assign the first 3 characters of query_data which represents the query id that the user did to variable quizno if quizno not in self.quizzes_done: data=query_data[-3:] oncallbackobject.add_count(quizno,data) bot.answerCallbackQuery(query_id, text='You chose ' + query_data[-3:].upper() + '!', show_alert=True) bot.sendMessage(from_id, "Thank you for your response! \n\nType 'elab <your feedback> 'to provide feedback. It's anonymous! Click /start to answer another query!") self.quizzes_done.append(quizno) ## adds this query id to the list of queries that is done by the user else: bot.sendMessage(from_id, "You have already done this query. Click /start to select another query") # checks if the user did this query before, prompt user to do another query bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id( pave_event_space())( per_chat_id(types=['private']), create_open, YayOrNay, timeout=999999999999), ]) print('Listening to responses...') bot.message_loop(run_forever='Listening ...')
def main(): global bot, authorized_users, cameras, verbose, settings, \ scheduler, cronsched, \ encodings, path_to_ffmpeg, max_photo_size, \ snapshot_queue, snapshooter, copy_to, \ do_send_text, text_queue, max_text_file_size, \ do_send_documents, document_queue, \ do_send_videos, video_queue, video_processor, \ audio_on, audio_volume, voice_queue, voice_processor, upload_folder, \ do_send_photos, photo_queue, photo_processor config_filename = 'smarthomebot-config.json' shelf = shelve.open('.smarthomebot.shelf') if APPNAME in shelf.keys(): settings = easydict(shelf[APPNAME]) try: with open(config_filename, 'r') as config_file: config = json.load(config_file) except FileNotFoundError as e: print('Error: config file not found: {}'.format(e)) return except ValueError as e: print('Error: invalid config file "{}": {}'.format(config_filename, e)) return telegram_bot_token = config.get('telegram_bot_token') if not telegram_bot_token: print('Error: config file doesn\'t contain a `telegram_bot_token`') return authorized_users = config.get('authorized_users') if type(authorized_users) is not list or len(authorized_users) == 0: print('Error: config file doesn\'t contain an `authorized_users` list') return cameras = config.get('cameras') if type(cameras) is not dict: print('Error: config file doesn\'t define any `cameras`') return timeout_secs = config.get('timeout_secs', 10 * 60) upload_folder = config.get('image_folder', '/home/ftp-upload') event_handler = UploadDirectoryEventHandler(ignore_directories=True) observer = Observer() observer.schedule(event_handler, upload_folder, recursive=True) try: observer.start() except OSError as e: import pwd print( 'ERROR: Cannot start observer. Make sure the folder {:s} exists and is writable for {:s}.' .format(upload_folder, pwd.getpwuid(os.getuid()).pw_name)) return path_to_ffmpeg = config.get('path_to_ffmpeg') max_photo_size = config.get('max_photo_size', TELEGRAM_MAX_PHOTO_DIMENSION) verbose = config.get('verbose', False) do_send_photos = config.get('send_photos', False) do_send_videos = config.get('send_videos', True) do_send_text = config.get('send_text', False) copy_to = config.get('copy_to', None) if isinstance(copy_to, str): if not os.path.isdir(copy_to): print('Error: {:s} (`copy_to`) doesn\'t point to a directory.'. format(copy_to)) return if not os.access(copy_to, os.W_OK): print('Error: {:s} (`copy_to`) is not writable.'.format(copy_to)) return if verbose: print('All received surveillance files will be backed up to {:s}'. format(copy_to)) max_text_file_size = config.get('max_text_file_size', 10 * TELEGRAM_MAX_MESSAGE_SIZE) do_send_documents = config.get('send_documents', False) audio_on = config.get('audio', {}).get('enabled', False) audio_volume = config.get('audio', {}).get('volume', 1.0) bot = telepot.DelegatorBot(telegram_bot_token, [ include_callback_query_chat_id(pave_event_space())( per_chat_id_in(authorized_users, types='private'), create_open, ChatUser, timeout=timeout_secs) ]) snapshot_queue = queue.Queue() snapshooter = threading.Thread(target=take_snapshot_thread) snapshooter.start() if do_send_text: text_queue = queue.Queue() text_processor = threading.Thread(target=process_text_thread) text_processor.start() if verbose: print('Enabled text processing.') if do_send_documents: document_queue = queue.Queue() document_processor = threading.Thread(target=process_document_thread) document_processor.start() if verbose: print('Enabled document processing.') if do_send_photos: photo_queue = queue.Queue() photo_processor = threading.Thread(target=process_photo_thread) photo_processor.start() if verbose: print('Enabled photo processing.') if do_send_videos: video_queue = queue.Queue() video_processor = threading.Thread(target=process_video_thread) video_processor.start() if verbose: print('Enabled video processing.') if audio_on: try: pygame.mixer.pre_init(frequency=TELEGRAM_AUDIO_BITRATE, size=-16, channels=2, buffer=4096) pygame.mixer.init() except: print("\nWARNING: Cannot initialize audio.\n" "*** See above warnings for details.\n" "*** Consider deactivating audio in your \n" "*** SurveillanceBot config file.\n") audio_on = False else: voice_queue = queue.Queue() voice_processor = threading.Thread(target=process_voice_thread) voice_processor.start() if verbose: print('Enabled audio processing.') if verbose: print('Monitoring {} ...'.format(upload_folder)) scheduler.start() scheduler.add_job(garbage_collector, 'cron', hour=0) try: bot.message_loop( run_forever='Bot listening ... (Press Ctrl+C to exit.)') except KeyboardInterrupt: pass if verbose: print('Exiting ...') observer.stop() observer.join() shelf[APPNAME] = settings shelf.sync() shelf.close() scheduler.shutdown() snapshot_queue.put(None) snapshooter.join() if do_send_videos: video_queue.put(None) video_processor.join() if do_send_photos: photo_queue.put(None) photo_processor.join() if do_send_text: text_queue.put(None) text_processor.join() if do_send_documents: document_queue.put(None) document_processor.join() if audio_on: voice_queue.put(None) voice_processor.join()
if content_type == 'new_chat_member': new_user_hello(msg) if content_type != 'text': print('Not a text message.') return if msg['text'] == '/boobs': print('boobs') sender_photo(chat_id, instagramm.Inst('boobs')) return if re.findall('/#.*', msg['text']): diez = msg['text'][3:] print(diez) sender_photo(chat_id, instagramm.Inst(diez)) # else: # sender_photo(chat_id, 'https://files5.adme.ru/files/comment/part_2036/20357060-1414483493.png') except Exception as e: sender_photo( chat_id, 'https://files5.adme.ru/files/comment/part_2036/20357060-1414483493.png' ) #TOKEN = '307520552:AAHVG_Yi7nshJHUDYOIn-4G6UXEfTY7egGU' TOKEN = '294022389:AAHVf5mAejze3naL9Q-BAXKEFHlR7Tdk7E4' bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(types=['group']), create_open, VoteCounter, timeout=10), ]) bot.message_loop(run_forever='Listening ...')
self._character_questions[self._current_question_num]['answers'] info(self._username, 'question: ' + self.question + '; choices: ' + str(choices)) self._sent = self.sender.sendMessage( self.question, reply_markup=InlineKeyboardMarkup(inline_keyboard=[[ InlineKeyboardButton(text=str(c), callback_data=str(c)) ] for c in choices])) TOKEN = sys.argv[1] PROXY = sys.argv[2] # https://89.165.218.82:47886 telepot.api.set_proxy(PROXY) bot = telepot.DelegatorBot(TOKEN, [ include_callback_query_chat_id(pave_event_space())( per_chat_id(types=['private']), create_open, SprintStarter, timeout=54000), ]) MessageLoop(bot).run_as_thread() info('Bot', 'Listening ...') while 1: time.sleep(10)