test tg bot
This commit is contained in:
parent
424a25ed15
commit
76b7ce67eb
|
@ -65,8 +65,11 @@ class TgBot:
|
||||||
async def admin_action(self, name, queryset):
|
async def admin_action(self, name, queryset):
|
||||||
if name == 'admin_get_image':
|
if name == 'admin_get_image':
|
||||||
async for item in queryset:
|
async for item in queryset:
|
||||||
|
try:
|
||||||
text = await TgBot.app.bot.get_file(item.text)
|
text = await TgBot.app.bot.get_file(item.text)
|
||||||
TgBotUpdater.return_queue.put(text.file_path)
|
TgBotUpdater.return_queue.put(text.file_path)
|
||||||
|
except Exception as e:
|
||||||
|
pass
|
||||||
|
|
||||||
async def set_handlers(self):
|
async def set_handlers(self):
|
||||||
TgBot.app.add_handler(
|
TgBot.app.add_handler(
|
||||||
|
|
|
@ -5,14 +5,18 @@ import { apiBase } from '~/helpers';
|
||||||
const headers = new Headers();
|
const headers = new Headers();
|
||||||
headers.append("Content-Type", "application/json");
|
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 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 = () => {
|
const openImage = () => {
|
||||||
isOpen.value = !isOpen.value
|
isOpen.value = !isOpen.value
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template v-if="file_url">
|
||||||
<a href="#">
|
<a href="#">
|
||||||
<Icon name="i-mdi-image" @click="openImage" />
|
<Icon name="i-mdi-image" @click="openImage" />
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Reference in New Issue