Skip to content

Commit

Permalink
Fix last character while splitting response
Browse files Browse the repository at this point in the history
  • Loading branch information
F33RNI committed Sep 9, 2023
1 parent 70813d7 commit bbd9a7d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions BotHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async def send_message_async(config: dict, messages: List[Dict],
if type(request_response.response) == str and len(request_response.response) > 0:
while True:
index_start = request_response.response_part_positions[-1]
response_part_length = len(request_response.response[index_start:-1])
response_part_length = len(request_response.response[index_start:])
if response_part_length > config["telegram"]["one_message_limit"]:
request_response.response_part_positions\
.append(index_start + config["telegram"]["one_message_limit"])
Expand Down Expand Up @@ -281,7 +281,7 @@ async def _send_text_async_split(config: dict,
# Get current part of response
response_part_index_start \
= request_response.response_part_positions[request_response.response_part_counter]
response_part_index_stop = -1
response_part_index_stop = len(request_response.response)
if request_response.response_part_counter < len(request_response.response_part_positions) - 1:
response_part_index_stop \
= request_response.response_part_positions[request_response.response_part_counter + 1]
Expand All @@ -301,7 +301,7 @@ async def _send_text_async_split(config: dict,
# Check if it is not empty
if len(response_part) > 0:
# Send with markup and exit from loop if it's the last part
if response_part_index_stop == -1:
if response_part_index_stop == len(request_response.response):
# Add cursor symbol?
if not end and config["telegram"]["add_cursor_symbol"]:
response_part += config["telegram"]["cursor_symbol"]
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from JSONReaderWriter import load_json

# GPT-Telegramus version
__version__ = "3.4.0"
__version__ = "3.4.1"

# Logging level
LOGGING_LEVEL = logging.INFO
Expand Down

0 comments on commit bbd9a7d

Please sign in to comment.