ChaterJee 0.2.7__py3-none-any.whl → 0.2.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ChaterJee/ChaterJee.py +23 -1
- {chaterjee-0.2.7.dist-info → chaterjee-0.2.9.dist-info}/METADATA +1 -1
- chaterjee-0.2.9.dist-info/RECORD +6 -0
- chaterjee-0.2.7.dist-info/RECORD +0 -6
- {chaterjee-0.2.7.dist-info → chaterjee-0.2.9.dist-info}/WHEEL +0 -0
- {chaterjee-0.2.7.dist-info → chaterjee-0.2.9.dist-info}/top_level.txt +0 -0
ChaterJee/ChaterJee.py
CHANGED
@@ -12,6 +12,7 @@ from telegram.ext import Updater, ApplicationBuilder, ContextTypes, CommandHandl
|
|
12
12
|
from telegram.constants import ParseMode
|
13
13
|
import os.path
|
14
14
|
import threading
|
15
|
+
import subprocess
|
15
16
|
from subprocess import PIPE, Popen
|
16
17
|
from pathlib import Path
|
17
18
|
|
@@ -148,7 +149,7 @@ class ChatLogs:
|
|
148
149
|
|
149
150
|
return ConversationHandler.END
|
150
151
|
|
151
|
-
def
|
152
|
+
def get_last_line0(self, filepath):
|
152
153
|
with open(filepath, 'rb') as f:
|
153
154
|
# Go to the end of file
|
154
155
|
f.seek(0, 2)
|
@@ -168,6 +169,27 @@ class ChatLogs:
|
|
168
169
|
last_line = f.read().decode('utf-8')
|
169
170
|
return last_line.strip()
|
170
171
|
|
172
|
+
def get_last_line(filepath):
|
173
|
+
if not os.path.exists(filepath):
|
174
|
+
return None
|
175
|
+
|
176
|
+
try:
|
177
|
+
command_chain = f"tail -n 1000 '{filepath}' | grep -Ev '^\s*$' | tail -n 1"
|
178
|
+
process = subprocess.run(command_chain, shell=True, capture_output=True, text=True, check=True)
|
179
|
+
|
180
|
+
output = process.stdout.strip()
|
181
|
+
if output:
|
182
|
+
return output
|
183
|
+
else:
|
184
|
+
return None
|
185
|
+
|
186
|
+
except subprocess.CalledProcessError as e:
|
187
|
+
return None
|
188
|
+
except FileNotFoundError:
|
189
|
+
return None
|
190
|
+
except Exception as e:
|
191
|
+
return None
|
192
|
+
|
171
193
|
async def cancel(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
172
194
|
self.smsID.append(update.message.message_id)
|
173
195
|
await context.bot.sendChatAction(chat_id=self.CHATID, action="typing")
|
@@ -0,0 +1,6 @@
|
|
1
|
+
ChaterJee/ChaterJee.py,sha256=ZowS5jnPzSt6o8ACigYei65uVDEfKzb6nL75Wsox7tU,13668
|
2
|
+
ChaterJee/__init__.py,sha256=tZmkZY2XbzJ8rHDh8nOmb1W73kPecPv3xcEiCPwkZf4,98
|
3
|
+
chaterjee-0.2.9.dist-info/METADATA,sha256=F95_Nvpn_jb71dvzdMDNlmn0UQkuilfHiA9VMq_Laos,5872
|
4
|
+
chaterjee-0.2.9.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
5
|
+
chaterjee-0.2.9.dist-info/top_level.txt,sha256=Z1UAYoaNybpDiKjqa1yFpti_q0FNECVItb3-9yAh3gM,10
|
6
|
+
chaterjee-0.2.9.dist-info/RECORD,,
|
chaterjee-0.2.7.dist-info/RECORD
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
ChaterJee/ChaterJee.py,sha256=oTSXbCSpfXB8f9m7ErXSFMlgGayGifI8FUHRa2DeFDg,12995
|
2
|
-
ChaterJee/__init__.py,sha256=tZmkZY2XbzJ8rHDh8nOmb1W73kPecPv3xcEiCPwkZf4,98
|
3
|
-
chaterjee-0.2.7.dist-info/METADATA,sha256=AlMpY3NNrzmlfUx5_1DfvBCAWxb4vA_l9e1bIECrtOw,5872
|
4
|
-
chaterjee-0.2.7.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
|
5
|
-
chaterjee-0.2.7.dist-info/top_level.txt,sha256=Z1UAYoaNybpDiKjqa1yFpti_q0FNECVItb3-9yAh3gM,10
|
6
|
-
chaterjee-0.2.7.dist-info/RECORD,,
|
File without changes
|
File without changes
|