Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -51,16 +51,24 @@ async def on_ready():
|
|
51 |
print(f'Logged in as {bot.user.name}')
|
52 |
print(f"XP_PER_MESSAGE: {XP_PER_MESSAGE}")
|
53 |
# testing sheet -> read -> paste sheet
|
54 |
-
|
55 |
#worksheet = gspread_bot.open("levelbot").sheet1
|
56 |
|
57 |
URL_test = "https://docs.google.com/spreadsheets/d/1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w/edit#gid=0"
|
58 |
csv_url_test = URL.replace('/edit#gid=', '/export?format=csv&gid=')
|
|
|
59 |
response = requests.get(csv_url_test)
|
60 |
if response.status_code == 200:
|
61 |
csv_content = response.text
|
62 |
-
|
63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
|
65 |
|
66 |
def calculate_level(xp):
|
|
|
51 |
print(f'Logged in as {bot.user.name}')
|
52 |
print(f"XP_PER_MESSAGE: {XP_PER_MESSAGE}")
|
53 |
# testing sheet -> read -> paste sheet
|
54 |
+
|
55 |
#worksheet = gspread_bot.open("levelbot").sheet1
|
56 |
|
57 |
URL_test = "https://docs.google.com/spreadsheets/d/1hQSsIg1Y9WdBF_CdNM1L1rUUREoxKqRTe3_ILo-WK8w/edit#gid=0"
|
58 |
csv_url_test = URL.replace('/edit#gid=', '/export?format=csv&gid=')
|
59 |
+
|
60 |
response = requests.get(csv_url_test)
|
61 |
if response.status_code == 200:
|
62 |
csv_content = response.text
|
63 |
+
csv_file = 'import.csv'
|
64 |
+
with open(csv_file, 'w', newline='') as file:
|
65 |
+
writer = csv.writer(file)
|
66 |
+
for row in csv_content:
|
67 |
+
writer.writerow(row)
|
68 |
+
|
69 |
+
csv_content = open('import.csv', 'r').read()
|
70 |
+
worksheet_test = gspread_bot.open("test").sheet1
|
71 |
+
gspread_bot.import_csv(worksheet_test.id, csv_content)
|
72 |
|
73 |
|
74 |
def calculate_level(xp):
|