ChaterJee 0.5.2__tar.gz → 0.5.4__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.
@@ -116,7 +116,7 @@ class ChatLogs:
116
116
  reply_keyboard = [[f'{job}'] for job in list(self.jobs.keys())[::-1]] # inverse to show latest jobs on top
117
117
  await context.bot.sendChatAction(chat_id=self.CHATID, action="typing")
118
118
  msg = await update.message.reply_text("Select a job to get updates on",\
119
- reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True, input_field_placeholder="Select the job."\
119
+ reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True, resize_keyboard=True, input_field_placeholder="Select the job."\
120
120
  ),\
121
121
  )
122
122
  self.smsID.append(msg.message_id)
@@ -134,6 +134,7 @@ class ChatLogs:
134
134
  logDIR = Path(jobs[job_name]['logDIR'])
135
135
  logFILE = jobs[job_name]['logFILE']
136
136
  logIMAGE = jobs[job_name]['logIMAGE']
137
+ logDICT = jobs[job_name]['logDICT']
137
138
 
138
139
  self.txt = self.get_last_line(logDIR / logFILE)
139
140
 
@@ -142,6 +143,10 @@ class ChatLogs:
142
143
  #await self.sendUpdate(update, context)
143
144
  #msg = await context.bot.send_message(chat_id=self.CHATID, text=txt)
144
145
  #self.smsID.append(msg.message_id)
146
+ elif logDICT is not None:
147
+ self.txt = self.txt + '\n'
148
+ for key, value in logDICT.items():
149
+ self.txt = self.txt + f"{key}: {value}\n"
145
150
 
146
151
  await context.bot.sendChatAction(chat_id=self.CHATID, action="typing")
147
152
  msg = await update.message.reply_text(
@@ -241,7 +246,7 @@ class ChatLogs:
241
246
  await context.bot.sendChatAction(chat_id=self.CHATID, action="typing")
242
247
  if len(JSONfiles):
243
248
  msg = await update.message.reply_text("Select a JSON file to edit",\
244
- reply_markup=ReplyKeyboardMarkup(JSONfiles, one_time_keyboard=True, input_field_placeholder="Select the file."\
249
+ reply_markup=ReplyKeyboardMarkup(JSONfiles, one_time_keyboard=True, resize_keyboard=True, input_field_placeholder="Select the file."\
245
250
  ),\
246
251
  )
247
252
  self.smsID.append(msg.message_id)
@@ -274,7 +279,8 @@ class ChatLogs:
274
279
  KeyboardButton(
275
280
  text="Editor Babu",
276
281
  web_app=WebAppInfo(url="https://pallab-dutta.github.io/EditorBabu"+extender),
277
- )
282
+ ),
283
+ resize_keyboard=True, one_time_keyboard=True
278
284
  ),
279
285
  )
280
286
  self.smsID.append(msg.message_id)
@@ -374,7 +380,7 @@ class ChatLogs:
374
380
  print(reply_keyboard)
375
381
  await context.bot.sendChatAction(chat_id=self.CHATID, action="typing")
376
382
  msg = await update.message.reply_text("Entire chat history in the current session will be cleared. Proceed?",\
377
- reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True, input_field_placeholder="Select to proceed."\
383
+ reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True, resize_keyboard=True, input_field_placeholder="Select to proceed."\
378
384
  ),\
379
385
  )
380
386
  self.smsID.append(msg.message_id)
@@ -396,7 +402,7 @@ class ChatLogs:
396
402
  print(reply_keyboard)
397
403
  await context.bot.sendChatAction(chat_id=self.CHATID, action="typing")
398
404
  msg = await update.message.reply_text("Your job will be killed. Proceed?",\
399
- reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True, input_field_placeholder="Select to proceed."\
405
+ reply_markup=ReplyKeyboardMarkup(reply_keyboard, one_time_keyboard=True, resize_keyboard=True, input_field_placeholder="Select to proceed."\
400
406
  ),\
401
407
  )
402
408
  self.smsID.append(msg.message_id)
@@ -432,8 +438,9 @@ class NoteLogs:
432
438
  self.logDIR = None
433
439
  self.logFILE = None
434
440
  self.logIMAGE = None
441
+ self.logDICT = None
435
442
 
436
- def write(self, jobNAME: str, logDIR: str = None, logSTRING: str = None, logFILE: str = 'log_file.out', logIMAGE: str = 'log_file.png'):
443
+ def write(self, jobNAME: str, logDIR: str = None, logSTRING: str = None, logFILE: str = 'log_file.out', logIMAGE: str = 'log_file.png', logDICT: dict = None):
437
444
  if logDIR is None:
438
445
  pwd = Path.cwd()
439
446
  _logDIR = pwd / jobNAME
@@ -454,6 +461,7 @@ class NoteLogs:
454
461
  self.logDIR = logDIR
455
462
  self.logFILE = logFILE
456
463
  self.logIMAGE = logIMAGE
464
+ self.logDICT = logDICT
457
465
  self.save_job_JSON()
458
466
 
459
467
  def save_job_JSON(self):
@@ -465,12 +473,22 @@ class NoteLogs:
465
473
  jobs = json.load(ffr)
466
474
  except FileNotFoundError:
467
475
  jobs = {}
468
- jobs[self.jobNAME] = {\
469
- "logDIR": self.logDIR, \
470
- "logFILE": self.logFILE, \
471
- "logIMAGE": self.logIMAGE \
472
- }
473
- with open(jobs_file, 'w') as ffw:
474
- json.dump(jobs, ffw, indent=4)
476
+ try:
477
+ jobD = jobs[self.jobNAME]
478
+ except KeyError:
479
+ jobs[self.jobNAME] = {}
480
+ jobD = {}
481
+ if self.logDIR is not None:
482
+ jobD["logDIR"] = self.logDIR
483
+ if self.logFILE is not None:
484
+ jobD["logFILE"] = self.logFILE
485
+ if self.logIMAGE is not None:
486
+ jobD["logIMAGE"] = self.logIMAGE
487
+ if self.logDICT is not None:
488
+ jobD["logDICT"] = self.logDICT
489
+ if len(jobD):
490
+ jobs[self.jobNAME] = jobD
491
+ with open(jobs_file, 'w') as ffw:
492
+ json.dump(jobs, ffw, indent=4)
475
493
 
476
494
 
@@ -1,19 +1,12 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: ChaterJee
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: Communicate your project updates via Telegram Bot!
5
5
  Author: Pallab Dutta
6
6
  Author-email: pallab9997@gmail.com
7
7
  Requires-Python: >=3.8
8
8
  Description-Content-Type: text/markdown
9
9
  Requires-Dist: python-telegram-bot==20.7
10
- Dynamic: author
11
- Dynamic: author-email
12
- Dynamic: description
13
- Dynamic: description-content-type
14
- Dynamic: requires-dist
15
- Dynamic: requires-python
16
- Dynamic: summary
17
10
 
18
11
  # ChaterJee
19
12
 
@@ -1,19 +1,12 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.1
2
2
  Name: ChaterJee
3
- Version: 0.5.2
3
+ Version: 0.5.4
4
4
  Summary: Communicate your project updates via Telegram Bot!
5
5
  Author: Pallab Dutta
6
6
  Author-email: pallab9997@gmail.com
7
7
  Requires-Python: >=3.8
8
8
  Description-Content-Type: text/markdown
9
9
  Requires-Dist: python-telegram-bot==20.7
10
- Dynamic: author
11
- Dynamic: author-email
12
- Dynamic: description
13
- Dynamic: description-content-type
14
- Dynamic: requires-dist
15
- Dynamic: requires-python
16
- Dynamic: summary
17
10
 
18
11
  # ChaterJee
19
12
 
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name='ChaterJee',
5
- version='0.5.2',
5
+ version='0.5.4',
6
6
  packages=find_packages(),
7
7
  install_requires=[
8
8
  'python-telegram-bot==20.7',
File without changes
File without changes