from aiogram.dispatcher.filters import BoundFilter
class MyFilter(BoundFilter):
key = 'is_admin'
def __init__(self, is_admin):
self.is_admin = is_admin
async def check(self, message: types.Message):
member = await bot.get_chat_member(message.chat.id, message.from_user.id)
return member.is_chat_admin()
dp.filters_factory.bind(MyFilter)
@dp.message_handler(is_admin=True)
async def ...
line 55 requests.exceptions.MissingSchema: Invalid URL '': No schema supplied. Perhaps you meant http://?
root@a:~# sqlite3
SQLite version 3.11.0 2016-02-15 17:29:24
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> CREATE TABLE table1(id INT PRIMARY KEY AUTOINCREMENT, fld1 INTEGER , fld2 INTEGER, fld3 INTEGER);
Error: AUTOINCREMENT is only allowed on an INTEGER PRIMARY KEY
sqlite> CREATE TABLE table1(id INTEGER PRIMARY KEY AUTOINCREMENT, fld1 INTEGER , fld2 INTEGER, fld3 INTEGER);
sqlite> CREATE TABLE table2(id INTEGER PRIMARY KEY AUTOINCREMENT, fld1 INTEGER , fld2 INTEGER, fld3 INTEGER);
sqlite> INSERT INTO table1(fld1, fld2, fld3) VALUES(15, 10, 5);
sqlite> INSERT INTO table1(fld1, fld2, fld3) VALUES(3, 6, 9);
sqlite> INSERT INTO table2(fld1, fld2, fld3) VALUES(5, 10, 15);
sqlite> INSERT INTO table2(fld1, fld2, fld3) VALUES(4, 8, 12);
sqlite> SELECT * FROM table1;
1|15|10|5
2|3|6|9
sqlite> SELECT * FROM table2;
1|5|10|15
2|4|8|12
sqlite> SELECT (table1.fld1 * table2.fld1)
...> FROM table1
...> INNER JOIN TABLE2 ON table1.id=table2.id;
75
12
sqlite> SELECT (table1.fld2 * table2.fld2)
...> FROM table1
...> INNER JOIN TABLE2 ON table1.id=table2.id;
100
48
sqlite> SELECT (table1.fld1 * table2.fld1), (table1.fld2 * table2.fld2), (table1.fld3 * table2.fld3)
...> FROM table1
...> INNER JOIN TABLE2 ON table1.id=table2.id;
75|100|75
12|48|108
sqlite>
if message.text == "951379" or "943718" or "735910" or "934270":
If message.text == 'a' or message.text == 'b' or message.text == 'c':
L = ['a', 'b', 'c']
If message.text in L:
Do
a = float(input("Введите свой вес: "))
b = float(input("Введите свой рост(см): "))
b = b / 100
bmi = a / b ** 2
if bmi < 16:
print('Дефицит массы')
elif 16 < bmi < 18.5:
print('Недостаточная масса тела')
elif 18.5 < bmi < 25:
print('Норма')
elif 25 < bmi < 30:
print('Избыточный вес')
elif bmi > 35:
print('Ожирение ')
with db.connect(db) as connection:
cursor = connection.cursor()
cursor.execute('''CREATE TABLE USERS (
user_id TEXT PRIMARY key,
username TEXT,
first_name TEXT,
last_name TEXT);'''
def add_user_info(user):
with db.connect(db) as connection:
cursor = connection.cursor()
try:
cursor.execute('''INSERT INTO USERS (user_id, username, first_name, last_name)
VALUES(?,?,?,?);''', user)
except Error:
pass