ChaterJee 0.3.5__py3-none-any.whl → 0.3.6__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 CHANGED
@@ -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), CommandHandler("clear", self.ask2clear)],\
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
- #msg = await context.bot.send_message(chat_id=self.CHATID, text=txt)
228
+ await self.sendUpdate(update, context)
226
229
  else:
227
- self.txt = "Expected a JSON file as argument. Nothing provided."
228
- #msg = await context.bot.send_message(chat_id=self.CHATID, text=txt)
229
-
230
- #self.smsID.append(msg.message_id)
231
- await self.sendUpdate(update, context)
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ChaterJee
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Communicate your project updates via Telegram Bot!
5
5
  Author: Pallab Dutta
6
6
  Author-email: pallab9997@gmail.com
@@ -0,0 +1,6 @@
1
+ ChaterJee/ChaterJee.py,sha256=cEThFOET19Db8YchANjxV46M9ljyu0elDKMyCiCI-GU,15937
2
+ ChaterJee/__init__.py,sha256=tZmkZY2XbzJ8rHDh8nOmb1W73kPecPv3xcEiCPwkZf4,98
3
+ chaterjee-0.3.6.dist-info/METADATA,sha256=-RUJD-5H6On5VuWrt_v5V7OZ1_euFgUu62IZqFWrE8I,5872
4
+ chaterjee-0.3.6.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
5
+ chaterjee-0.3.6.dist-info/top_level.txt,sha256=Z1UAYoaNybpDiKjqa1yFpti_q0FNECVItb3-9yAh3gM,10
6
+ chaterjee-0.3.6.dist-info/RECORD,,
@@ -1,6 +0,0 @@
1
- ChaterJee/ChaterJee.py,sha256=YX--rsYhNpwQuS4paSjY_86gdPLapzT0nFdvxn-UT8Q,14284
2
- ChaterJee/__init__.py,sha256=tZmkZY2XbzJ8rHDh8nOmb1W73kPecPv3xcEiCPwkZf4,98
3
- chaterjee-0.3.5.dist-info/METADATA,sha256=vBZmewg98vsKrZ74yzfjUrnL6Ud0ElG9V-fK_NGAldo,5872
4
- chaterjee-0.3.5.dist-info/WHEEL,sha256=iAkIy5fosb7FzIOwONchHf19Qu7_1wCWyFNR5gu9nU0,91
5
- chaterjee-0.3.5.dist-info/top_level.txt,sha256=Z1UAYoaNybpDiKjqa1yFpti_q0FNECVItb3-9yAh3gM,10
6
- chaterjee-0.3.5.dist-info/RECORD,,