This commit is contained in:
Dawid Rejowski 2022-09-11 23:38:22 +02:00
parent c6fd3d999f
commit 1b10650b71

View file

@ -43,30 +43,24 @@ class Command:
pack_name = self.args[0] pack_name = self.args[0]
reuploader = MatrixReuploader(self.client, self.room, exporter=self.tg_exporter) reuploader = MatrixReuploader(self.client, self.room, exporter=self.tg_exporter)
async for status in reuploader.import_stickerset_to_room(pack_name): async for status in reuploader.import_stickerset_to_room(pack_name):
text = 'Warning: Unknown status' switch = {
if status == MatrixReuploader.STATUS_DOWNLOADING: MatrixReuploader.STATUS_DOWNLOADING: f'Downloading stickerpack {pack_name}...',
text = f'Downloading stickerpack {pack_name}...' MatrixReuploader.STATUS_UPLOADING: f'Uploading stickerpack {pack_name}...',
if status == MatrixReuploader.STATUS_UPLOADING: MatrixReuploader.STATUS_UPDATING_ROOM_STATE: f'Uploading stickerpack {pack_name}...',
text = f'Uploading stickerpack {pack_name}...' MatrixReuploader.STATUS_OK: 'Done 😄',
if status == MatrixReuploader.STATUS_UPDATING_ROOM_STATE: MatrixReuploader.STATUS_NO_PERMISSION: (
text = f'Updating room state...'
if status == MatrixReuploader.STATUS_OK:
text = 'Done 😄'
if status == MatrixReuploader.STATUS_NO_PERMISSION:
text = (
'I do not have permissions to create any stickerpack in this room\n' 'I do not have permissions to create any stickerpack in this room\n'
'Please, give me mod 🙏' 'Please, give me mod 🙏'
) ),
if status == MatrixReuploader.STATUS_PACK_EXISTS: MatrixReuploader.STATUS_PACK_EXISTS: (
text = (
f"Stickerpack '{pack_name}' already exists.\n" f"Stickerpack '{pack_name}' already exists.\n"
'Please delete it first.' 'Please delete it first.'
) ),
if status == MatrixReuploader.STATUS_PACK_EMPTY: MatrixReuploader.STATUS_PACK_EMPTY: (
text = (
f'Warning: Telegram pack {pack_name} find out empty or not existing.' f'Warning: Telegram pack {pack_name} find out empty or not existing.'
) )
}
text = switch.get(status, 'Warning: Unknown status')
await send_text_to_room(self.client, self.room.room_id, text) await send_text_to_room(self.client, self.room.room_id, text)
async def _unknown_command(self): async def _unknown_command(self):