Queer European MD passionate about IT
浏览代码

Logical error in `Bot().split_message_text` method

Davte 5 年之前
父节点
当前提交
b03b24fb2d
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      davtelepot/bot.py

+ 2 - 2
davtelepot/bot.py

@@ -829,10 +829,10 @@ class Bot(TelegramBot, ObjectWithDatabase):
                 text[-1] = text[-1][limit:]
                 text[-1] = text[-1][limit:]
             text_chunk = "\n".join(temp)  # Re-join this group of lines
             text_chunk = "\n".join(temp)  # Re-join this group of lines
             prefix, suffix = '', ''
             prefix, suffix = '', ''
-            is_last = len(text) > 0
+            is_last = len(text) == 0
             if text_part_number > 1:
             if text_part_number > 1:
                 prefix = f"{tags[0]}[...]{tags[1]}\n"
                 prefix = f"{tags[0]}[...]{tags[1]}\n"
-            if is_last:
+            if not is_last:
                 suffix = f"\n{tags[0]}[...]{tags[1]}"
                 suffix = f"\n{tags[0]}[...]{tags[1]}"
             yield (prefix + text_chunk + suffix), is_last
             yield (prefix + text_chunk + suffix), is_last
         return
         return