Exemple #1
0
def divine_intervention(bot, job):
    logger.info('Divine intervention!')

    for uid in usermanager.get_telegram_users():
        global msg, image, buttons
        msg = ''
        image = None
        buttons = None

        def rep(txt, btns=None, photo=None):
            global msg, image, buttons

            if len(msg) + len(txt) + 2 >= 4096:
                reply(uid, bot, msg, buttons, image)

                msg = ''
                image = None
                buttons = None

            msg += '\n\n'
            msg += txt

            if btns:
                buttons = btns
            if photo:
                image = photo

        usermanager.divine_intervention(uid, rep)

        if len(msg) > 0 or image:
            reply(uid, bot, msg, buttons, image)
Exemple #2
0
def divine_intervention(bot, job):
	logger.info('Divine intervention!')

	for uid in usermanager.get_telegram_users():
		global msg, image, buttons
		msg = ''
		image = None
		buttons = None

		def rep(txt, btns=None, photo=None):
			global msg, image, buttons

			if len(msg) + len(txt) + 2 >= 4096:
				reply(uid, bot, msg, buttons, image)

				msg = ''
				image = None
				buttons = None


			msg += '\n\n'
			msg += txt

			if btns:
				buttons = btns
			if photo:
				image = photo
				
		usermanager.divine_intervention(uid, rep)

		if len(msg) > 0 or image:
			reply(uid, bot, msg, buttons, image)