Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
70 lines (60 loc) · 2.72 KB

File metadata and controls

70 lines (60 loc) · 2.72 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from __future__ import annotations
from maxbot_api_client_python.types.models import (
Attachment, AttachmentType, AudioAttachmentPayload, ContactAttachmentPayload,
FileAttachmentPayload, Keyboard, KeyboardButton, PhotoAttachmentPayload,
ShareAttachmentPayload, StickerAttachmentPayload, VideoAttachmentPayload
)
def attach_image(token: str | None = None, url: str | None = None) -> Attachment:
return Attachment(
type=AttachmentType.IMAGE,
payload=PhotoAttachmentPayload(token=token, url=url).model_dump(exclude_none=True)
)
def attach_video(token: str | None = None, url: str | None = None) -> Attachment:
return Attachment(
type=AttachmentType.VIDEO,
payload=VideoAttachmentPayload(token=token, url=url).model_dump(exclude_none=True)
)
def attach_audio(token: str | None = None, url: str | None = None) -> Attachment:
return Attachment(
type=AttachmentType.AUDIO,
payload=AudioAttachmentPayload(token=token, url=url).model_dump(exclude_none=True)
)
def attach_file(token: str | None = None, url: str | None = None, filename: str | None = None) -> Attachment:
return Attachment(
type=AttachmentType.FILE,
payload=FileAttachmentPayload(token=token, url=url, filename=filename).model_dump(exclude_none=True)
)
def attach_sticker(url: str | None = None, code: str | None = None) -> Attachment:
return Attachment(
type=AttachmentType.STICKER,
payload=StickerAttachmentPayload(url=url, code=code).model_dump(exclude_none=True)
)
def attach_contact(name: str, phone: str, contact_id: int | None = None) -> Attachment:
safe_name = name.replace("\n", " ").replace("\r", "")
safe_phone = phone.replace("\n", "").replace("\r", "")
vcf_info = f"BEGIN:VCARD\nVERSION:3.0\nFN:{safe_name}\nTEL:{safe_phone}\nEND:VCARD"
return Attachment(
type=AttachmentType.CONTACT,
payload=ContactAttachmentPayload(
name=name,
contact_id=contact_id,
vcf_info=vcf_info,
vcf_phone=phone
).model_dump(exclude_none=True)
)
def attach_keyboard(buttons: list[list[KeyboardButton]]) -> Attachment:
return Attachment(
type=AttachmentType.KEYBOARD,
payload=Keyboard(buttons=buttons).model_dump(exclude_none=True)
)
def attach_share(url: str | None = None, title: str | None = None, desc: str | None = None) -> Attachment:
return Attachment(
type=AttachmentType.SHARE,
payload=ShareAttachmentPayload(url=url, title=title, description=desc).model_dump(exclude_none=True)
)
def attach_location(lat: float, lon: float) -> Attachment:
return Attachment(
type=AttachmentType.LOCATION,
latitude=lat,
longitude=lon
)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.