ChaterJee 0.3.5__tar.gz → 0.3.7__tar.gz
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-0.3.5 → chaterjee-0.3.7}/ChaterJee/ChaterJee.py +43 -8
- {chaterjee-0.3.5 → chaterjee-0.3.7}/ChaterJee.egg-info/PKG-INFO +1 -1
- {chaterjee-0.3.5 → chaterjee-0.3.7}/PKG-INFO +1 -1
- {chaterjee-0.3.5 → chaterjee-0.3.7}/setup.py +1 -1
- {chaterjee-0.3.5 → chaterjee-0.3.7}/ChaterJee/__init__.py +0 -0
- {chaterjee-0.3.5 → chaterjee-0.3.7}/ChaterJee.egg-info/SOURCES.txt +0 -0
- {chaterjee-0.3.5 → chaterjee-0.3.7}/ChaterJee.egg-info/dependency_links.txt +0 -0
- {chaterjee-0.3.5 → chaterjee-0.3.7}/ChaterJee.egg-info/requires.txt +0 -0
- {chaterjee-0.3.5 → chaterjee-0.3.7}/ChaterJee.egg-info/top_level.txt +0 -0
- {chaterjee-0.3.5 → chaterjee-0.3.7}/README.md +0 -0
- {chaterjee-0.3.5 → chaterjee-0.3.7}/setup.cfg +0 -0
@@ -62,17 +62,20 @@ class ChatLogs:
|
|
62
62
|
application.add_handler(cancel_handler)
|
63
63
|
|
64
64
|
jobs_handler = ConversationHandler(\
|
65
|
-
entry_points=[CommandHandler("jobs", self.ShowJobs)
|
65
|
+
entry_points=[CommandHandler("jobs", self.ShowJobs),\
|
66
|
+
CommandHandler("clear", self.ask2clear)],\
|
67
|
+
CommandHandler("edit", self.EditorBabu)],\
|
66
68
|
states={
|
67
69
|
0: [MessageHandler(filters.Regex("^(JOB)"), self.StatJobs)],
|
68
70
|
1: [MessageHandler(filters.Regex("^(Yes|No)$"), self.ClearChat)],
|
71
|
+
2: [MessageHandler(filters.Regex("^(FILE)$"), self.SendEditButton)],
|
69
72
|
},
|
70
73
|
fallbacks=[CommandHandler("cancel", self.cancel)],
|
71
74
|
)
|
72
75
|
application.add_handler(jobs_handler)
|
73
76
|
|
74
77
|
application.add_handler(MessageHandler(filters.StatusUpdate.WEB_APP_DATA, self.web_app_data))
|
75
|
-
application.add_handler(MessageHandler(filters.TEXT & ~(filters.COMMAND | filters.Regex("^(JOB:|Yes$|No$)")), self.commands))
|
78
|
+
application.add_handler(MessageHandler(filters.TEXT & ~(filters.COMMAND | filters.Regex("^(JOB:|FILE:|Yes$|No$)")), self.commands))
|
76
79
|
|
77
80
|
#await application.shutdown()
|
78
81
|
#await application.initialize()
|
@@ -222,13 +225,45 @@ class ChatLogs:
|
|
222
225
|
self.smsID.append(msg.message_id)
|
223
226
|
else:
|
224
227
|
self.txt = f"File {file_path} not Found!"
|
225
|
-
|
228
|
+
await self.sendUpdate(update, context)
|
226
229
|
else:
|
227
|
-
|
228
|
-
#
|
229
|
-
|
230
|
-
|
231
|
-
|
230
|
+
JSONfiles = get_json_files(".")
|
231
|
+
#self.txt = "Expected a JSON file as argument. Nothing provided."
|
232
|
+
#await self.sendUpdate(update, context)
|
233
|
+
await context.bot.sendChatAction(chat_id=self.CHATID, action="typing")
|
234
|
+
if len(JSONfiles):
|
235
|
+
msg = await update.message.reply_text("Select a JSON file to edit",\
|
236
|
+
reply_markup=ReplyKeyboardMarkup(JSONfiles, one_time_keyboard=True, input_field_placeholder="Select the file."\
|
237
|
+
),\
|
238
|
+
)
|
239
|
+
self.smsID.append(msg.message_id)
|
240
|
+
return 2
|
241
|
+
else:
|
242
|
+
self.txt = f"No JSON file found in the current directory!"
|
243
|
+
await self.sendUpdate(update, context)
|
244
|
+
|
245
|
+
def get_json_files(directory):
|
246
|
+
json_files = []
|
247
|
+
for filename in os.listdir(directory):
|
248
|
+
if filename.endswith(".json"):
|
249
|
+
json_files.append([f"FILE: {filename}"])
|
250
|
+
return json_files
|
251
|
+
|
252
|
+
async def SendEditButton(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
|
253
|
+
self.smsID.append(update.message.message_id)
|
254
|
+
file_name = update.message.text[6:]
|
255
|
+
extender = f"?variables={encoded_params}&fileNAME={file_name}"
|
256
|
+
await context.bot.sendChatAction(chat_id=self.CHATID, action="typing")
|
257
|
+
msg = await update.message.reply_text(
|
258
|
+
"Editor-Babu is opening the Json file.",
|
259
|
+
reply_markup=ReplyKeyboardMarkup.from_button(
|
260
|
+
KeyboardButton(
|
261
|
+
text="Editor Babu",
|
262
|
+
web_app=WebAppInfo(url="https://pallab-dutta.github.io/EditorBabu"+extender),
|
263
|
+
)
|
264
|
+
),
|
265
|
+
)
|
266
|
+
self.smsID.append(msg.message_id)
|
232
267
|
|
233
268
|
async def web_app_data(self, update: Update, context: ContextTypes.DEFAULT_TYPE) -> None :
|
234
269
|
data = json.loads(update.effective_message.web_app_data.data)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|