-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
101 lines (69 loc) · 3.59 KB
/
main.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#############################################################################
# #
# #
# .ss` os: #
# `` .ys.`oy: .--` .-/++/:-` #
# -oyhhm/:hhddhh-+myydhdys++oshdo. #
# .yms-..Ms```yM`` sM` -My `-smo #
# dm. `My yM sM+:oMh` /Ns #
# .Ms `My` yM sNsso:Nh hM #
# dm- MNyhohM sM` .Ny `mm #
# `sdyooyd+.oMNM:::hm` oM/...--:/odh. #
# `://:. hsssssss- `oysyyyyso/- #
# #
# #
# #
# #
# #
# #
#############################################################################
import os
import discord
from dotenv import load_dotenv
from bs4 import BeautifulSoup
import requests
import xml.dom.minidom
from gitMain import autoMaintain
#from cairosvg import svg2png
import time
import json
import asyncio
import datetime
def addPoints(user):
with open(user["name"] + '.json', 'w') as f:
user["points"] += 1
json.dump(user, f)
def main():
before = ""
while True:
commit = autoMaintain()
if before != str(commit):
print(commit[0])
print(commit[1])
# client.loop.create_task(channel.send(f"{commit[0]} just commited with the message, {commit[1]}"))
try:
with open(commit[0] + '.json', 'r') as f:
user = json.load(f)
# if pts.checkForLevelUp(user["points"]) != user["level"]:
# embed=discord.Embed(title="", url="", description="", color=0x1CEEEE)
# #embed.set_thumbnail(url="https://github.com/AndreasInk/HyperDashDiscordBot/blob/main/trophy.png?raw=true")
# user["level"] = pts.checkForLevelUp(user["points"])
# embed.add_field(name= "Level", value= f"{user['name']} reached level {user['level']}", inline=False)
# client.loop.create_task(channel.send(embed=embed))
addPoints(user=user)
except:
user = {}
user["id"] = 0
user["name"] = commit[0]
user["points"] = 0
user["level"] = 0
with open("names" + '.txt', 'a') as f:
# try:
txt = ("\n" + user["name"])
f.write(txt)
# except:
# f.write(user["name"])
addPoints(user= user)
before = str(commit)
time.sleep(10)
main()