Example #1
0
def send_msg_by_chunks(msg: Message,
                       text: str,
                       delim: str,
                       parse_mode=None,
                       keyboard=None):
    chunks = ['']
    for t in text.split(delim):
        if len(chunks[-1] + t) + 3 < 4096:
            chunks[-1] += '\n' + t
        else:
            chunks[-1] += '```'
            chunks.append('```' + t)

    for reply in chunks:
        msg.reply_text(reply, parse_mode=parse_mode, reply_markup=keyboard)
Example #2
0
def on_verdict_sent(msg: Message, reply: str, result: int):
    msg.reply_text('Something went wrong... '
                   'Please contact developers' if result == 500 else reply)