Answer the question
In order to leave comments, you need to log in
How to bypass telegram bot blocking?
How to bypass the telegram bot blocking, I want to make a mailing list, sends only a couple to users, and then writes that the user has blocked the bot and stops the function.
@bot.message_handler(commands=['send'])
def send_stat(message):
user_id = str(message.from_user.id)
if user_id == str(460989471):
args = message.text.split(' ')
del args[0]
args = ' '.join(args)
with sqlite3.connect("db.db") as con:
cur = con.cursor()
cur.execute(f"""SELECT user_id FROM subscriptions""")
call_sp=str(cur.fetchall()).replace('(','').replace(')','').replace("'",'').replace("[",'').replace("]",',')
cur.execute(f"select count(*) from subscriptions")
cilc = int(str(cur.fetchall()).replace('(','').replace(')','').replace("'",'').replace(',','').replace('[','').replace(']',''))
text = call_sp
print(text)
while cilc>0:
text = call_sp
index = text.find(',')
index = index + len(',')
aa1 = (text[:index]).replace(",","")
call_sp = call_sp.replace(f"{aa1},, ", "")
text = text.replace("{aa1},,","")
print(text)
cilc -= 1
chat_id = aa1
bot.send_message(chat_id, args,parse_mode="html")
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question