def __init__(self): Bot.__init__(self, '1234:abcd1234') self.bot = _EncapsulatedTelegramTestBot() self.dispatcher = Dispatcher(self, None) self.test_value = False self.send_message = None self.admin_user = ('First', 'Second')
def __init__(self, token=None, chat_id=None): if token is None or chat_id is None: with open(CONFIG_FILE, "r+") as f: config = json.load(f) token = config["token"] chat_id = config["chat_id"] Bot.__init__(self, token) self.chat_id = chat_id
def __init__(self): config = configparser.ConfigParser() config.read('./config') sources = configparser.ConfigParser() sources.read('./sources') tokens = configparser.ConfigParser() tokens.read('./tokens') log_file = config['Export_params']['log_file'] Bot.__init__(self, token=tokens['Telegram']['access_token']) self.pub_pause = int(config['Export_params']['pub_pause']) self.delay_between_messages = int( config['Export_params']['delay_between_messages']) logging.basicConfig( format= u'%(filename)s[LINE:%(lineno)d]# %(levelname)-8s [%(asctime)s] %(message)s', level=logging.INFO, handlers=[logging.FileHandler(u'%s' % log_file, 'w', 'utf-8')]) self.db = DatabaseHandler(config['Database']['Path']) self.src = RssParser(sources['RSS']) self.chat_id = config['Telegram']['chat'] # self.bot_access_token = tokens['Telegram']['access_token'] # self.bot = Bot(token=self.bot_access_token) self.bit_ly = Bitly(tokens['Bitly']['access_token'])