2022-01-16 08:48:05 +00:00
|
|
|
from pyrogram import Client
|
2022-01-26 06:37:52 +00:00
|
|
|
from pyrogram.errors import PhotoInvalidDimensions
|
2022-01-16 08:48:05 +00:00
|
|
|
from pyrogram.types import Message
|
|
|
|
from os import sep
|
|
|
|
from defs.query_resource_points import get_resource_map_mes, get_resource_list_mes, init_point_list_and_map
|
|
|
|
|
|
|
|
init_resource_map = False
|
|
|
|
|
|
|
|
|
|
|
|
async def inquire_resource_points(client: Client, message: Message):
|
|
|
|
global init_resource_map
|
|
|
|
if not init_resource_map:
|
|
|
|
await init_point_list_and_map()
|
|
|
|
init_resource_map = True
|
|
|
|
resource_name = message.text.replace("哪里有", "").strip()
|
|
|
|
if resource_name == "":
|
|
|
|
return await message.reply("没有想好要找的资源吗?试试 `资源列表`", quote=True)
|
|
|
|
text = await get_resource_map_mes(resource_name)
|
|
|
|
if text.find("没有") != -1:
|
|
|
|
return await message.reply(text, quote=True)
|
2022-01-26 06:37:52 +00:00
|
|
|
try:
|
|
|
|
await message.reply_photo(f"temp{sep}map.jpg", caption=text, quote=True)
|
|
|
|
except PhotoInvalidDimensions:
|
|
|
|
await message.reply_document(f"temp{sep}map.jpg", caption=text, quote=True)
|
2022-01-16 08:48:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
async def inquire_resource_list(client: Client, message: Message):
|
|
|
|
global init_resource_map
|
|
|
|
if not init_resource_map:
|
|
|
|
await init_point_list_and_map()
|
|
|
|
init_resource_map = True
|
|
|
|
text = get_resource_list_mes()
|
|
|
|
await message.reply(text, quote=True)
|