diff --git a/back/tgbot/tgbot.py b/back/tgbot/tgbot.py index 4401582..ffe83ab 100644 --- a/back/tgbot/tgbot.py +++ b/back/tgbot/tgbot.py @@ -65,8 +65,11 @@ class TgBot: async def admin_action(self, name, queryset): if name == 'admin_get_image': async for item in queryset: - text = await TgBot.app.bot.get_file(item.text) - TgBotUpdater.return_queue.put(text.file_path) + try: + text = await TgBot.app.bot.get_file(item.text) + TgBotUpdater.return_queue.put(text.file_path) + except Exception as e: + pass async def set_handlers(self): TgBot.app.add_handler( diff --git a/front/components/getImage.vue b/front/components/getImage.vue index f10cf41..5e05ec1 100644 --- a/front/components/getImage.vue +++ b/front/components/getImage.vue @@ -5,14 +5,18 @@ import { apiBase } from '~/helpers'; const headers = new Headers(); headers.append("Content-Type", "application/json"); -const file_url_data = await $fetch(`${apiBase}/tgbot/items/get_image/${props.file_id}/`, { headers }) -const file_url = file_url_data[0] const isOpen = ref(false) +const file_url = ref() + +const file_url_data = await $fetch(`${apiBase}/tgbot/items/get_image/${props.file_id}/`, { headers }) +if ((file_url_data as string[]).length > 0) { + file_url.value = (file_url_data as string[])[0] +} const openImage = () => { isOpen.value = !isOpen.value } -