Skip to content

Commit

Permalink
Remake New Algorithm !
Browse files Browse the repository at this point in the history
  • Loading branch information
SilentDemonSD authored Dec 1, 2022
1 parent 121ac9e commit 71cf524
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions bot/helper/telegram_helper/message_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,16 +139,14 @@ def deleteMessage(bot, message):
def sendLogFile(bot, message):
logFileRead = open('log.txt', 'r')
logFileLines = logFileRead.read().splitlines()
ind = len(logFileLines)
toDisplay = 0
ind = 1
Loglines = ''
try:
while len(Loglines) <= 2500:
Loglines += logFileLines[-ind]+'\n'
toDisplay += 1
if ind == 1: break
ind -= 1
startLine = f"Generated Last {toDisplay} Lines from log.txt: \n\n---------------- START LOG -----------------\n\n"
Loglines = logFileLines[-ind]+'\n'+Loglines
if ind == len(logFileLines): break
ind += 1
startLine = f"Generated Last {ind} Lines from log.txt: \n\n---------------- START LOG -----------------\n\n"
endLine = "\n---------------- END LOG -----------------"
sendMessage(escape(startLine+Loglines+endLine), bot, message)
except Exception as err:
Expand Down

0 comments on commit 71cf524

Please sign in to comment.