Skip to content

Instantly share code, notes, and snippets.

@ashkanRmk
Last active March 1, 2018 09:41
Show Gist options
  • Save ashkanRmk/054fd9ae2b2028c4903b7c2a9b61025d to your computer and use it in GitHub Desktop.
Save ashkanRmk/054fd9ae2b2028c4903b7c2a9b61025d to your computer and use it in GitHub Desktop.
from telegram import ParseMode
from telegram.ext import Updater
import time
updater = Updater('BOT-TOKEN-ID')
chatIds = ["109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039",
"109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039",
"109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039",
"109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039",
"109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039", "109416039"]
notSendIds = []
for chat_id in chatIds:
try:
updater.bot.send_message(chat_id=chat_id,
text='*Your Desire Only Text*',
parse_mode=ParseMode.MARKDOWN)
updater.bot.sendPhoto(chat_id=chat_id,
photo='https://telegram.org/img/t_logo.png',
caption="Image with Caption!")
except:
notSendIds.append(chat_id)
time.sleep(5)
print("\nYour message was not send to these users:\n")
for id in notSendIds:
print(id)
print("\nTotal: " + str(len(notSendIds)) + "/" + str(len(chatIds)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment