Skip to content
This repository was archived by the owner on Jan 17, 2023. It is now read-only.

Commit 45fd627

Browse files
author
Benjamin O'Brien
committed
Finish mini update
1 parent 6a5c42f commit 45fd627

File tree

3 files changed

+21
-13
lines changed

3 files changed

+21
-13
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ __pycache__/
66
.env
77

88
# Please dont track the dbs plz :)
9-
# being removed soon
109
db/
1110

1211
# No need for vs code stuff

assets/cogs/top.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ def __init__(self, bot):
1414

1515
# Link to le' bot
1616
def setup(bot):
17-
bot.add_cog(TopGG(bot))
17+
bot.add_cog(TopGG(bot))
18+

assets/prism.py

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,19 @@
44
# Last revision on August 25th, 2020.
55

66
# Modules
7-
from .functions import clear, server_check
8-
9-
10-
11-
127
import discord
138
from random import choice
149

1510
from asyncio import sleep
16-
from os import system, name
17-
1811
from .logging import Logging
12+
1913
from json import loads, dumps
14+
from os import system, listdir
2015

2116
from operator import itemgetter
2217
from discord.ext import commands, tasks
2318

19+
from .functions import clear, server_check
2420
from Levenshtein.StringMatcher import StringMatcher
2521

2622
# Bot creation
@@ -218,13 +214,25 @@ async def on_message(message):
218214

219215
command = command.split(" ")[0]
220216

221-
if not command in db[str(user.id)]["data"]["commands"]["used"]:
217+
exists = False
218+
219+
for command_folder in listdir("commands"):
220+
221+
for _ in listdir(f"commands/{command_folder}"):
222+
223+
if _ != "__pycache__" and _.replace(".py", "") == command:
224+
225+
exists = True
226+
227+
if exists:
228+
229+
if not command in db[str(user.id)]["data"]["commands"]["used"]:
222230

223-
db[str(user.id)]["data"]["commands"]["used"][command] = 0
231+
db[str(user.id)]["data"]["commands"]["used"][command] = 0
224232

225-
db[str(user.id)]["data"]["commands"]["used"][command] += 1
233+
db[str(user.id)]["data"]["commands"]["used"][command] += 1
226234

227-
db[str(user.id)]["data"]["commands"]["sent"] += 1
235+
db[str(user.id)]["data"]["commands"]["sent"] += 1
228236

229237
open("db/users", "w").write(dumps(db, indent = 4))
230238

0 commit comments

Comments
 (0)