all repos — gif-escarbot @ 692a24c44d15d2a19f660124767bf2793442253a

Earthbound Café's custom delivery bot with other cool utilities built-in.

send.py (view raw)

 1from dotenv import load_dotenv
 2from os import getenv
 3load_dotenv()
 4
 5## Config start
 6endpoint = "sendMessage"
 7payload = {
 8    "chat_id": getenv("group_id"),
 9    "text": "Hello world!",
10    
11    "parse_mode": "markdown",
12    "reply_to_message_id": "",
13    "disable_web_page_preview": False,
14    "disable_notification": False,
15}
16## Config end
17
18''' EXAMPLES
19
20endpoint = "sendVideo"
21payload = {
22    "chat_id": getenv("group_id"),
23    "video": "https://media.tenor.com/zKYNgCu5TjYAAAAC/ness-pk-fire.gif",
24    "caption": "Test caption",
25    
26    "parse_mode": "markdown",
27    "reply_to_message_id": "",
28    "disable_web_page_preview": False,
29    "disable_notification": False,
30}
31
32endpoint = "sendPhoto"
33payload = {
34    "chat_id": getenv("group_id"),
35    "photo": "https://media.tenor.com/zKYNgCu5TjYAAAAC/ness-pk-fire.gif",
36    "caption": "Test caption",
37    
38    "parse_mode": "markdown",
39    "reply_to_message_id": "",
40    "disable_web_page_preview": False,
41    "disable_notification": False,
42}
43'''
44
45from requests import post
46response = post(f"https://api.telegram.org/bot{getenv('token')}/{endpoint}", json=payload,
47                headers={ "accept": "application/json", "content-type": "application/json" })
48print(response.text)