You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
544 B
23 lines
544 B
#!/usr/bin/env python3
|
|
|
|
from telegram import Bot
|
|
|
|
from db import get_conn, Subscriber, commit
|
|
from config import BOT_TOKEN
|
|
|
|
|
|
if __name__ == '__main__':
|
|
bot = Bot(BOT_TOKEN)
|
|
conn = get_conn()
|
|
uids = input('Please input user ids split by spaces: ')
|
|
for uid in uids.split():
|
|
try:
|
|
uid = int(uid)
|
|
except (ValueError, TypeError):
|
|
pass
|
|
|
|
conn.root.subscribers[uid] = Subscriber.from_chat(bot.get_chat(uid))
|
|
commit()
|
|
conn.close()
|
|
print('Users have been successfully imported')
|