add location
This commit is contained in:
1 parent
ff615e434e
commit
9733c264e9
1 file changed
+36
-1
@@ -138,6 +138,21 @@ async def guest_middleware(handler, event, data):
|
|||||||
|
|
||||||
prompt = ""
|
prompt = ""
|
||||||
|
|
||||||
|
if replied and replied.location:
|
||||||
|
loc = replied.location
|
||||||
|
prompt += (
|
||||||
|
f"<ответ на локацию>\n"
|
||||||
|
f"{loc.latitude}, {loc.longitude}\n"
|
||||||
|
f"</ответ на локацию>\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
if message.location:
|
||||||
|
loc = message.location
|
||||||
|
prompt += (
|
||||||
|
f"<локация>\n"
|
||||||
|
f"{loc.latitude}, {loc.longitude}\n"
|
||||||
|
f"</локация>\n"
|
||||||
|
)
|
||||||
if replied and replied.poll:
|
if replied and replied.poll:
|
||||||
poll = replied.poll
|
poll = replied.poll
|
||||||
if poll.allows_multiple_answers:
|
if poll.allows_multiple_answers:
|
||||||
@@ -222,7 +237,7 @@ async def guest_middleware(handler, event, data):
|
|||||||
return await handler(event, data)
|
return await handler(event, data)
|
||||||
|
|
||||||
|
|
||||||
@router.message(F.content_type.in_({"text", "photo", "document", "poll"}))
|
@router.message(F.content_type.in_({"text", "photo", "document", "poll", "location"}))
|
||||||
async def text_handler(message: Message):
|
async def text_handler(message: Message):
|
||||||
chat_type = message.sender_chat.type if message.sender_chat else ""
|
chat_type = message.sender_chat.type if message.sender_chat else ""
|
||||||
user_id = message.sender_chat.id if message.sender_chat else message.from_user.id
|
user_id = message.sender_chat.id if message.sender_chat else message.from_user.id
|
||||||
@@ -327,8 +342,27 @@ async def text_handler(message: Message):
|
|||||||
print(f"{RED} -- {e}{RESET}")
|
print(f"{RED} -- {e}{RESET}")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
if replied and replied.location:
|
||||||
|
loc = replied.location
|
||||||
|
|
||||||
|
prompt += (
|
||||||
|
f"<ответ на локацию>\n"
|
||||||
|
f"{loc.latitude}, {loc.longitude}\n"
|
||||||
|
f"</ответ на локацию>\n"
|
||||||
|
)
|
||||||
|
|
||||||
|
if message.location:
|
||||||
|
loc = message.location
|
||||||
|
|
||||||
|
prompt += (
|
||||||
|
f"<локация>\n"
|
||||||
|
f"{loc.latitude}, {loc.longitude}\n"
|
||||||
|
f"</локация>\n"
|
||||||
|
)
|
||||||
|
|
||||||
elif replied and replied.photo and IMAGE_MODEL != "":
|
elif replied and replied.photo and IMAGE_MODEL != "":
|
||||||
try:
|
try:
|
||||||
|
if not msg:
|
||||||
msg = await message.reply("👀")
|
msg = await message.reply("👀")
|
||||||
except Exception:
|
except Exception:
|
||||||
return
|
return
|
||||||
@@ -345,6 +379,7 @@ async def text_handler(message: Message):
|
|||||||
prompt = f"<ответ на фото>{image_text}</ответ на фото>\n<подпись в ответе>{replied.caption}</подпись в ответе>\n"
|
prompt = f"<ответ на фото>{image_text}</ответ на фото>\n<подпись в ответе>{replied.caption}</подпись в ответе>\n"
|
||||||
else:
|
else:
|
||||||
prompt = f"<ответ на фото>{image_text}</ответ на фото>\n<подпись в ответе>{replied.caption}\n"
|
prompt = f"<ответ на фото>{image_text}</ответ на фото>\n<подпись в ответе>{replied.caption}\n"
|
||||||
|
if not msg:
|
||||||
await msg.edit_text("💬")
|
await msg.edit_text("💬")
|
||||||
|
|
||||||
elif replied and replied.text:
|
elif replied and replied.text:
|
||||||
|
|||||||
Reference in new issue
Block a user