add dump command
This commit is contained in:
parent
eaeb631be3
commit
6520e9ef50
@ -223,7 +223,7 @@ class ChannelHelperBotModuleConfig(TelegramBotModuleConfig):
|
||||
update.effective_message.reply_text('GTFO')
|
||||
return
|
||||
update.effective_message.reply_document(
|
||||
BytesIO(json.dumps(list(QueuedItem.objects.filter(config=self).values()), indent=2).encode()),
|
||||
BytesIO(json.dumps(list(qi.__json__() for qi in QueuedItem.objects.filter(config=self)), indent=2).encode()),
|
||||
filename='dump.json',
|
||||
)
|
||||
|
||||
@ -251,6 +251,17 @@ class QueuedItem(models.Model):
|
||||
processed = models.BooleanField(default=False)
|
||||
datetime = models.DateTimeField(auto_now_add=True)
|
||||
|
||||
def __json__(self):
|
||||
return {
|
||||
'type': self.type,
|
||||
'args': self.args,
|
||||
'message_id': self.message_id,
|
||||
'message_ids_extra': self.message_ids_extra,
|
||||
'image_hash': self.image_hash,
|
||||
'processed': self.processed,
|
||||
'datetime': self.datetime.isoformat(),
|
||||
}
|
||||
|
||||
def send(self, bot: Bot):
|
||||
if self.type == 'photo' and self.config.should_send_photo_group():
|
||||
items = [self] + list(self.config.get_additional_images(self.pk))
|
||||
|
Loading…
Reference in New Issue
Block a user