aboutsummaryrefslogtreecommitdiff
path: root/code/cogs
diff options
context:
space:
mode:
authorParker <contact@pkrm.dev>2024-04-11 00:37:27 -0500
committerParker <contact@pkrm.dev>2024-04-11 00:37:27 -0500
commit757b31fe4ea4fcf09f724588c65e4318c8bea792 (patch)
tree50c2bb814ecf2b86db4a9ba0a1aaa1b5845e9faa /code/cogs
parentca3d136126f2f8d6cf522502af3204c78fc45b22 (diff)
Accept `black` code reformats
Diffstat (limited to 'code/cogs')
-rw-r--r--code/cogs/owner/stats.py27
1 files changed, 15 insertions, 12 deletions
diff --git a/code/cogs/owner/stats.py b/code/cogs/owner/stats.py
index f6a7dec..3ca31a2 100644
--- a/code/cogs/owner/stats.py
+++ b/code/cogs/owner/stats.py
@@ -11,9 +11,11 @@ class Stats(commands.Cog):
self.bot = bot
def cog_load(self):
- connection = sqlite3.connect('count.db')
+ connection = sqlite3.connect("count.db")
cursor = connection.cursor()
- cursor.execute("CREATE TABLE IF NOT EXISTS count (command_name, count, PRIMARY KEY (command_name))")
+ cursor.execute(
+ "CREATE TABLE IF NOT EXISTS count (command_name, count, PRIMARY KEY (command_name))"
+ )
connection.commit()
connection.close()
@@ -21,20 +23,25 @@ class Stats(commands.Cog):
@tasks.loop(seconds=30)
async def dump_count(self):
- connection = sqlite3.connect('count.db')
+ connection = sqlite3.connect("count.db")
cursor = connection.cursor()
for command_name, count in self.bot.temp_command_count.items():
try:
- cursor.execute("INSERT INTO count (command_name, count) VALUES (?, ?)", (command_name, count))
+ cursor.execute(
+ "INSERT INTO count (command_name, count) VALUES (?, ?)",
+ (command_name, count),
+ )
except sqlite3.IntegrityError:
- cursor.execute("UPDATE count SET count = count + ? WHERE command_name = ?", (count, command_name))
+ cursor.execute(
+ "UPDATE count SET count = count + ? WHERE command_name = ?",
+ (count, command_name),
+ )
connection.commit()
connection.close()
self.bot.temp_command_count = {}
-
@commands.Cog.listener()
async def on_app_command_completion(self, interaction, command):
try:
@@ -42,18 +49,14 @@ class Stats(commands.Cog):
except KeyError:
self.bot.temp_command_count[interaction.command.name] = 1
-
@commands.command()
@commands.dm_only()
@commands.is_owner()
async def stats(self, ctx: commands.Context):
- connection = sqlite3.connect('count.db')
+ connection = sqlite3.connect("count.db")
cursor = connection.cursor()
- embed = discord.Embed(
- title="Command Statistics",
- color=BOT_COLOR
- )
+ embed = discord.Embed(title="Command Statistics", color=BOT_COLOR)
total = 0
data = cursor.execute("SELECT * FROM count").fetchall()