# обычный обработчик команд через /
@bot.message_handler(commands=['start'])
def start_message(message):
...
commands = {"start": start_message}
@bot.message_handler(content_types=['text'])
def main_parser(message):
if message.text.startswith('!'):
command = message.text.split()[0][1:]
func = commands.get(command)
if func:
func(message)
else:
# обработка обычного текста
# определяем список (массив) данных для заполнения построчно
data = []
for line in log:
# парсим лог построчно, заполняя нужные значения (user_name, login_time и т.п.)
# когда все значения определены, заносим строку в наш список данных
data.append([user_name, login_time, ... ])
# после окончания цикла у нас готовый вложенный список со всеми данными, из которого мы можем создать DF
df = pd.DataFrame(data, columns=['user_name', 'login_time', и т.д. все наши колонки, которые заносили в data])
import tkinter as tk
IMAGE_DATA = '''
iVBORw0KGgoAAAANSUhEUgAAABwAAAAcCAYAAAByDd+UAAAABmJLR0QA/wD/AP+gvaeTAAAACXBI
WXMAAAsTAAALEwEAmpwYAAAJt0lEQVRIx0WVe3Bd1XXGf2vv87pXunpdvSzJetqKbCNsYmOwNdgp
BUygzGQczMTQElpgmEwz7iNhJjDNtCQNQ6cpBGxwJzVJ2hBoKUkIBgLYDTHYYGNbtmRLtmVjGz2g
kqz3vZLuPefs3T8k0jWzZ83sP/b6vm99a20AtmzZgtaaIAjwfZ/a2lpVWpZWL//+Qz66OORcvWbN
puJE8M+eyCEFY0AI5BSMu8LhokTw9MqVK2965a393nO/+C8qq6tVZWWl8jwPz/MA6OjoAEA6Ojo4
dOgQAK7nUVVVrQYH+o21VjU2Nt451N//rRjWFdfUq+q2dtINzRSmKxAgOzHGlU8uMnzuNBODly3G
dFek00//9Nd7f3HbDRvyy5e3qgsXzhtrLbt37+b9999HWAzP80iny/WSuro4VVzS8tHBAz+ez4c3
Lt90i73+rq/TtHqdTaaKUEpELOIosCI2Mtj5zAwDPSek661XOb3/DQlnpo5evW79AzOTE90T4+N6
ZGQk/ryOTqVSaK1JJBIabOz63o0njhx+J1XbtOrOJ56Lb7p/Bw0NDVLqgpvPSWAjSdoIx4Q4YSgJ
k5eEo6SupVWaVl9rQ4uZn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6ySC9HjRd18RtO/6KW775aP7om3vlvZ/u0rV1dd+4
+PHHv6xceY3Tf+pELK7rEoYhnuvofBjFy1pbt17o63uh5bobEl95+LH4rWcel6V9p9Saqiqy+TxD
mQyXM1nGXBdd10j9F69n5cZNtKy+llRVrenv7bYvfvev9cUj70V1S5d+Y3BgYE9pTZ0eHxqI5xcH
5g9RUlKiPc+Na5Y2fPH0ieM/cQqKVrdtvtlmslkkN2cTxSVS3rhMGtrXUN/WTnldA34yaeeyWftJ
T7cc+u//oPPVl8Tm58+vuKr9wVNdXQdShYV6emYmfnLns/RfvoRs376dzZs389BDDyEiLFu+XPX0
9Zl/e+Hl4Pvf+uYDoyOjOxJFJctLG5ppuHottSvaCYpKyOdzTF0Z5crF8wz1nGT4fC8mn+svT6d3
b/36/bvq6hsy//rDJ3Rf17H48Sef4dSpU0xOTi4w27hxI0oEz3XxXJd0WZmqqKhUd993P3/5tw8X
1Ncs+WrC0T8X6AOygAGMwJyCSwnHebmhru6eHd95tHjL1m2UlKWloqJCfa7ckSNHuPXWWwH4P6n1
YN4/wKY0AAAAAElFTkSuQmCC
'''
root = tk.Tk()
image = tk.PhotoImage(data=IMAGE_DATA)
label = tk.Label(root, image=image)
label.pack()
root.mainloop()
sql.execute(f"INSERT INTO filter (product, industry) VALUES (?, ?)", (product,industry))
Тогда проставить результаты можно за одно действие.