-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_file.py
More file actions
29 lines (24 loc) · 880 Bytes
/
send_file.py
File metadata and controls
29 lines (24 loc) · 880 Bytes
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
from maxbot_api_client_python import API, Config
from maxbot_api_client_python.types.models import SendFileReq
def main():
try:
with API(Config(
base_url="https://platform-api.max.ru",
token="YOUR_BOT_TOKEN",
ratelimiter=25,
timeout=30
)) as bot:
request = SendFileReq(
user_id=123456789, # recipient user ID
text="Check this!",
file_source="https://storage.yandexcloud.net/sw-prod-03-test/ChatBot/corgi.jpg"
)
response = bot.helpers.send_file(request)
if response:
print("send_file success!")
else:
print("send_file failed to process the file.")
except Exception as e:
print(f"Error: {e}")
if __name__ == "__main__":
main()