-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb_add_karma.py
36 lines (31 loc) · 1.01 KB
/
db_add_karma.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
import sys
from database import db_init as db
from sqlite3 import IntegrityError
import flairsync
# This script must receive 4 arguments (username, karma, platform, subreddit)
def main():
try:
username = sys.argv[1]
karma = int(sys.argv[2])
plat = sys.argv[3]
option = int(sys.argv[4])
sub = 'SummonSign' if option < 1 else 'BeyondTheFog'
except IndexError:
print("Error: Missing Arguments!")
try:
connection = db.connect()
db.create_tables(connection)
for i in range(karma):
try:
db.sync_karma_plat(connection, '-Firekeeper-', username, plat, sub)
except IntegrityError as err:
print(err)
except Exception as err:
print(err)
db_karma = db.get_user_karma(connection, username)
print(f"userflair synced: {username} : {db_karma}")
flairsync.main(username)
except Exception as err:
print(err)
if __name__ == '__main__':
main()