forked from MortezaBashsiz/Sudoer_VPN_bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbrd.py
59 lines (45 loc) · 1.09 KB
/
brd.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import threading
import telebot
import base64
import json
import sqlite3
#admins = [260723447]
def create_connection(db_file):
""" create a database connection to the SQLite database
specified by db_file
:param db_file: database file
:return: Connection object or None
"""
conn = None
try:
conn = sqlite3.connect(db_file)
return conn
except Error as e:
print(e)
return conn
bot = telebot.TeleBot("token token token token token", parse_mode=None)
text="""
درود
اطلاعرسانی
سپاس فراوان
"""
id="260723447"
database = r"/opt/bot/bot.db"
conn = create_connection(database)
sql = ''' SELECT id FROM users '''
cur = conn.cursor()
cur.execute(sql)
conn.commit()
users=cur.fetchall()
bot.send_message(id,text)
input("OK??")
for id in list(users):
try:
bot.send_message(id[0],text)
print("sucess id:",id[0])
except Exception as e:
print("id:",id[0],"\n", e)
sql = ''' DELETE FROM users where id=? '''
cur = conn.cursor()
cur.execute(sql, (id[0],))
conn.commit()