diff --git a/import_users.py b/import_users.py index 9bd0283..b05740e 100755 --- a/import_users.py +++ b/import_users.py @@ -13,4 +13,5 @@ if __name__ == '__main__': for uid in uids.split(): conn.root.subscribers[uid] = Subscriber.from_chat(bot.get_chat(uid)) commit() + conn.close() print('Users have been successfully imported') diff --git a/send_users_list.py b/send_users_list.py index 8a2ebd6..d82ccbc 100755 --- a/send_users_list.py +++ b/send_users_list.py @@ -3,7 +3,7 @@ from telegram import Bot from db import get_conn, Subscriber -from config import BOT_TOKEN, ADMIN +from config import BOT_TOKEN, MANAGEMENT_CHAT def send_users_list(bot: Bot = None): @@ -24,7 +24,10 @@ def send_users_list(bot: Bot = None): messages.append(msg) for i in range(0, len(messages), 40): - bot.send_message(ADMIN, '\n'.join(messages[i:i+40]), parse_mode='html') + bot.send_message(MANAGEMENT_CHAT, '\n'.join(messages[i:i+40]), parse_mode='html') + + print('User list was sent to the management chat') + conn.close() if __name__ == '__main__':