SHARE
TWEET

Untitled

a guest Feb 27th, 2020 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import requests
  2.  
  3. def mailing():
  4.  
  5.     TOKEN = '1010620213:AAG2GV0_9qPMrTNjNxDXT9OWFaG6Rlc-5IQ'
  6.  
  7.     with open('messages_ids.txt', "r") as mailing:
  8.         ids_list = [line.split('\n')[0] for line in mailing]
  9.     for chat_id in ids_list:
  10.         try:
  11.             post = 'Починил бота,всё работает!!!'
  12.             url = requests.post(f'https://api.telegram.org/bot{TOKEN}/sendMessage?chat_id=' + chat_id + '&text=' + post)
  13.             print('Рассылка отправлена ' + chat_id)
  14.         except:
  15.             print('Рассылка не отправлена ' + chat_id)
  16.            
  17.  
  18. mailing()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top