test tg bot

This commit is contained in:
Kseninia Mikhaylova 2024-07-18 14:32:01 +03:00
parent 424a25ed15
commit 76b7ce67eb
2 changed files with 12 additions and 5 deletions

View File

@ -65,8 +65,11 @@ class TgBot:
async def admin_action(self, name, queryset):
if name == 'admin_get_image':
async for item in queryset:
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(

View File

@ -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
}
</script>
<template>
<template v-if="file_url">
<a href="#">
<Icon name="i-mdi-image" @click="openImage" />
</a>