From 8b1ae97ffed9aca44659daf72a5b87d57548563f Mon Sep 17 00:00:00 2001 From: supopur Date: Mon, 1 May 2023 21:10:14 +0200 Subject: [PATCH] Removed SQL it was a bad idea, fixed a unasigned variable in /embed error handling --- commands.py | 47 ++--------------------------------------------- 1 file changed, 2 insertions(+), 45 deletions(-) diff --git a/commands.py b/commands.py index 5f99c0f..1ad1888 100644 --- a/commands.py +++ b/commands.py @@ -28,46 +28,6 @@ class EssentialCommands(commands.Cog): self.bot = bot self.rep_file = "cogs/essentials/reputation" - #Here it inits a new guild specific config in storage.db like all the commands enabled, events, or some specific storage like reputation. - def sql_guild_init(self, serverid): - # Define the SQL statement to create a table - conn = self.bot.api.db_api.connection - cursor = self.bot.api.db_api.cursor - sql = """ - CREATE TABLE essentials_server_serverid ( - command_ping TEXT (1, 1) DEFAULT (TRUE), - command_say TEXT (1, 1) DEFAULT (TRUE), - command_serverinfo TEXT (1, 1) DEFAULT (TRUE), - command_avatar TEXT (1, 1) DEFAULT (TRUE), - command_whois TEXT (1, 1) DEFAULT (TRUE), - command_embed TEXT (1, 1) DEFAULT (TRUE), - command_clean TEXT (1, 1) DEFAULT (TRUE), - command_lock TEXT (1, 1) DEFAULT (TRUE), - command_unlock TEXT (1, 1) DEFAULT (TRUE), - command_lockdown TEXT (1, 1) DEFAULT (FALSE), - command_unlockdown TEXT (1, 1) DEFAULT (FALSE), - event_goodbye_enabled TEXT (1, 1) DEFAULT (TRUE), - event_goodbye_title TEXT (1, 1) DEFAULT 'Goodbye', - event_goodbye_message TEXT (1, 1) DEFAULT '{member.display_name} has left the server.', - event_goodbye_channelid TEXT (1, 1) DEFAULT 'INSERT THE CHANNEL ID OF THE CHANNEL TO SEND THE GOODBYE MEESAGE HERE', - event_welcome_enabled TEXT (1, 1) DEFAULT (TRUE), - event_welcome_title TEXT (1, 1) DEFAULT 'Welcome', - event_welcome_message TEXT (1, 1) DEFAULT 'Welcome to the server {member.mention} :wave:', - event_welcome_channelid TEXT (1, 1) DEFAULT 'INSERT THE CHANNEL ID OF THE GOODBYE CHANNEL CAN BE THE SAME AS THE WELCOME CHANNEL' - );""" - - sql = sql.replace("serverid", str(serverid)) - #return sql - - # Execute the SQL statement - cursor.execute(sql) - - # Commit the transaction - conn.commit() - - def sql_init(self): - pass - @discord.Cog.listener() async def on_member_join(self, member): @@ -195,10 +155,7 @@ class EssentialCommands(commands.Cog): return 0 await ctx.respond('Pong!') - @commands.slash_command(guild_ids=guild_ids) - async def getalltables(self, ctx): - tables = self.sql_guild_init(ctx.guild.id) - await ctx.respond(tables) + @commands.slash_command(guild_ids=guild_ids) @option('msg', description="The message to say.") async def say(self, ctx, message): @@ -364,7 +321,7 @@ class EssentialCommands(commands.Cog): atr = getattr(discord.Color, color) embed.color = atr() except Exception as e: - bot.api.logger("inf", f"Command ivoked a error wrong color: {e}") + self.bot.api.logger("inf", f"Command ivoked a error wrong color: {e}") ctx.send("ERR: Invalid color.") return 1 if footer: