-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinfo.py
45 lines (40 loc) · 1.53 KB
/
info.py
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
from os import getenv
import requests
TOKEN = getenv('BOT_TOKEN')
CHAT_ID = getenv('CHAT_ID')
API_URL = f"https://api.telegram.org/bot{TOKEN}/sendMessage"
if __name__ == '__main__':
result = requests.get('https://quotes.rest/qod?language=en')
body = result.json()
if 'error' in body:
quote = 'Beep, Bop AeroBot menggunakan Telegram Bot'
author = 'AeroBot'
permalink = 'https://github.com/bbta3-bppt/aerobot'
else:
quote = body['contents']['quotes'][0]['quote']
author = body['contents']['quotes'][0]['author']
permalink = body['contents']['quotes'][0]['permalink']
MESSAGE = f'''
*Beeb, Bop, Sobat Aero BBTA3* 🤖\n
**Jangan Lupa Checkin/Checkout kehadiran ya 🖐🏽**\n\n
Kepada pegawai yang bekerja dirumah (WFH) dan kepada pegawai yang bekerja di kantor (WFO)
tetap menjalankan protokol kesehatan, antara lain\n
1. Mengecek suhu tubuh di gerbang Puspiptek dan BBTA3
2. *Memakai masker*
3. *Mencuci tangan* secara periodik dengan sabun dan hand sanitizer
4. *Menjaga jarak* dengan pegawai lainnya
5. Membawa peralatan dan makan siang dari rumah
6. Membawa peralatan shalat/ sajadah dari rumah
7. Jika kurang enak badan harap menghubungi sub bag RT atau satgas Covid 19 BBTA3
8. Pegawai WFH untuk pekerjaan dan laporan nya silahkan koordinasi dengan atasan langsung\n
_{quote} - {author}_\n
[SELENGKAPNYA]({permalink})
'''
requests.post(
API_URL,
json={
'chat_id': CHAT_ID,
'text': MESSAGE,
'parse_mode': 'Markdown'
}
)