From 8fbcb53e5409a73d5eb488437e26aaa0991fdfba Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 17:55:36 +0200 Subject: [PATCH 01/15] Unify bot typehint, and use correct discord.Bot class for it --- cogs/blacklist.py | 5 ++--- cogs/checkip.py | 5 ++--- cogs/cogs.py | 5 ++--- cogs/error.py | 5 ++--- cogs/info.py | 5 ++--- cogs/internallogs.py | 5 ++--- cogs/setserver.py | 5 ++--- cogs/status.py | 5 ++--- main.py | 3 +-- 9 files changed, 17 insertions(+), 26 deletions(-) diff --git a/cogs/blacklist.py b/cogs/blacklist.py index 14f2d28..013dbf1 100644 --- a/cogs/blacklist.py +++ b/cogs/blacklist.py @@ -1,13 +1,12 @@ import discord from discord import slash_command, option from discord.ext import commands -from discord.ext.bridge import Bot from utilities.database import modifier class Blacklist(discord.Cog): - def __init__(self, bot: Bot): + def __init__(self, bot: discord.Bot): self.bot = bot @slash_command() @@ -22,5 +21,5 @@ async def blacklist(self, ctx, server, reason): return await ctx.respond(f'Successfully added guild {server} to the blacklist for:\n**{reason}**') -def setup(bot: Bot): +def setup(bot: discord.Bot): bot.add_cog(Blacklist(bot)) diff --git a/cogs/checkip.py b/cogs/checkip.py index 06c6d23..33e40e5 100644 --- a/cogs/checkip.py +++ b/cogs/checkip.py @@ -2,14 +2,13 @@ import discord from discord import slash_command, option, Embed -from discord.ext.commands import Bot from utilities.data import Colors, get_server_status from utilities.utility import check_ip class CheckIP(discord.Cog): - def __init__(self, bot: Bot): + def __init__(self, bot: discord.Bot): self.bot = bot @slash_command(aliases=["checkserverip", "check"], description="Checks if an Aternos-IP is free to use.") @@ -33,5 +32,5 @@ async def checkip(self, ctx, address): await ctx.respond(embed=embed, ephemeral=True) -def setup(bot: Bot): +def setup(bot: discord.Bot): bot.add_cog(CheckIP(bot)) diff --git a/cogs/cogs.py b/cogs/cogs.py index 9ab7db6..63d15b3 100644 --- a/cogs/cogs.py +++ b/cogs/cogs.py @@ -2,14 +2,13 @@ import discord from discord import Option -from discord.ext.bridge import Bot from discord.ext.commands import slash_command from utilities.data import get_data class Cogs(discord.Cog): - def __init__(self, bot: Bot): + def __init__(self, bot: discord.Bot): self.bot = bot self.info = get_data() @@ -51,5 +50,5 @@ async def cogs(self, ctx, action: Option(choices=["Load", "Unload", "Reload"]), await ctx.respond(f"{action}ed {cog} and reloaded all commands!") -def setup(bot: Bot): +def setup(bot: discord.Bot): bot.add_cog(Cogs(bot)) diff --git a/cogs/error.py b/cogs/error.py index 7fc06f5..a5a4613 100644 --- a/cogs/error.py +++ b/cogs/error.py @@ -1,10 +1,9 @@ import discord from discord.ext import commands -from discord.ext.bridge import Bot class Error(discord.Cog): - def __init__(self, bot: Bot): + def __init__(self, bot: discord.Bot): self.bot = bot @commands.Cog.listener() @@ -29,5 +28,5 @@ async def on_application_command_error(self, ctx, error): raise error -def setup(bot: Bot): +def setup(bot: discord.Bot): bot.add_cog(Error(bot)) diff --git a/cogs/info.py b/cogs/info.py index e617bed..3ccf41e 100644 --- a/cogs/info.py +++ b/cogs/info.py @@ -2,13 +2,12 @@ import discord from discord import slash_command, Embed -from discord.ext.commands import Bot from utilities.data import Colors, get_server_status class Info(discord.Cog): - def __init__(self, bot: Bot): + def __init__(self, bot: discord.Bot): self.bot = bot @slash_command(aliases=["information", "ping", "latency", "pong", "servers", "guilds", "support", "invite"], description="Displays information about Pingernos") @@ -36,5 +35,5 @@ async def info(self, ctx): await ctx.respond(embed=embed) -def setup(bot: Bot): +def setup(bot: discord.Bot): bot.add_cog(Info(bot)) diff --git a/cogs/internallogs.py b/cogs/internallogs.py index 9d2c691..8309019 100644 --- a/cogs/internallogs.py +++ b/cogs/internallogs.py @@ -2,14 +2,13 @@ import discord from discord import Guild, Embed, Webhook from discord.ext import commands -from discord.ext.bridge import Bot from utilities.data import Colors, get_data from utilities.database import selector class InternalLogs(discord.Cog): - def __init__(self, bot: Bot): + def __init__(self, bot: discord.Bot): self.bot = bot @commands.Cog.listener() @@ -49,5 +48,5 @@ async def on_guild_remove(self, guild: Guild): await webhook.send(embed=embed, username="Pingernos Logs", avatar_url=self.bot.user.avatar.url) -def setup(bot: Bot): +def setup(bot: discord.Bot): bot.add_cog(InternalLogs(bot)) diff --git a/cogs/setserver.py b/cogs/setserver.py index 3cf1d4a..b52aea5 100644 --- a/cogs/setserver.py +++ b/cogs/setserver.py @@ -1,14 +1,13 @@ import discord from discord import slash_command from discord.ext import commands -from discord.ext.commands import Bot from utilities.database import modifier from utilities.utility import check_ip class SetServer(discord.Cog): - def __init__(self, bot: Bot): + def __init__(self, bot: discord.Bot): self.bot = bot @slash_command(aliases=["set"], description="Set the default server to use if no argument is provided in the status command.") @@ -25,5 +24,5 @@ async def setserver(self, ctx, server=None): await ctx.respond(f'The IP has been set to {server}. Use `status` without an argument to view it.' , ephemeral=True) -def setup(bot: Bot): +def setup(bot: discord.Bot): bot.add_cog(SetServer(bot)) diff --git a/cogs/status.py b/cogs/status.py index a5aa877..10f2c10 100644 --- a/cogs/status.py +++ b/cogs/status.py @@ -2,7 +2,6 @@ import discord from discord import slash_command, option, Embed, utils as dutils -from discord.ext.commands import Bot from utilities.data import remove_colors_from_string, Colors, get_server_status from utilities.database import selector @@ -10,7 +9,7 @@ class Status(discord.Cog): - def __init__(self, bot: Bot): + def __init__(self, bot: discord.Bot): self.bot = bot @slash_command(aliases=["s"], description="Get the server status") @@ -61,5 +60,5 @@ async def status(self, ctx, serverip=None): await ctx.respond(embed=embed) -def setup(bot: Bot): +def setup(bot: discord.Bot): bot.add_cog(Status(bot)) diff --git a/main.py b/main.py index 1ea596a..d265b2e 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,4 @@ -from discord import Intents, Status, Activity, ActivityType -from discord.ext.bridge import AutoShardedBot +from discord import Intents, Status, Activity, ActivityType, AutoShardedBot from utilities.database import mysql_login from utilities.data import get_data From 645f2b24e4307caa40e6c6eeaa9ef714c831b8bb Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 17:57:03 +0200 Subject: [PATCH 02/15] Fix up blacklist.py --- cogs/blacklist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/blacklist.py b/cogs/blacklist.py index 013dbf1..7b7d431 100644 --- a/cogs/blacklist.py +++ b/cogs/blacklist.py @@ -18,7 +18,7 @@ async def blacklist(self, ctx, server, reason): await modifier("INSERT IGNORE INTO blacklist (guild_id, reason) VALUES (%s, %s)", [server.id, reason]) guild = self.bot.get_guild(server.id) await guild.leave() - return await ctx.respond(f'Successfully added guild {server} to the blacklist for:\n**{reason}**') + await ctx.respond(f'Successfully added guild {server} to the blacklist for:\n**{reason}**') def setup(bot: discord.Bot): From 6930f83fffa5b7ef80eaf4a23f2580723fe27820 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 18:02:15 +0200 Subject: [PATCH 03/15] Fix up and unify cmd descriptions and slash decorator --- cogs/checkip.py | 3 ++- cogs/cogs.py | 3 ++- cogs/info.py | 3 ++- cogs/setserver.py | 3 ++- cogs/status.py | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cogs/checkip.py b/cogs/checkip.py index 33e40e5..cbe746a 100644 --- a/cogs/checkip.py +++ b/cogs/checkip.py @@ -11,9 +11,10 @@ class CheckIP(discord.Cog): def __init__(self, bot: discord.Bot): self.bot = bot - @slash_command(aliases=["checkserverip", "check"], description="Checks if an Aternos-IP is free to use.") + @slash_command() @option("address", str, description="The Aternos-IP to check") async def checkip(self, ctx, address): + """ Checks if an Aternos-IP is free to use. """ address = check_ip(address) if not address: return await ctx.respond("Please provide a valid Aternos IP.", ephemeral=True) diff --git a/cogs/cogs.py b/cogs/cogs.py index 63d15b3..4181bc9 100644 --- a/cogs/cogs.py +++ b/cogs/cogs.py @@ -21,8 +21,9 @@ def getcogs(self, ctx) -> list: cogs.append(file[:-3]) return cogs - @slash_command(description='Only the owners of the bot can run this command', guild_ids=get_data()['FeatureGuilds']) + @slash_command(guild_ids=get_data()['FeatureGuilds']) async def cogs(self, ctx, action: Option(choices=["Load", "Unload", "Reload"]), cog: Option(autocomplete=getcogs)): + """ Only the owners of the bot can run this command """ if ctx.author.id not in self.info['Owners']: return if cog.lower() not in [f"{fn[:-3]}" for fn in listdir("./cogs")]: diff --git a/cogs/info.py b/cogs/info.py index 3ccf41e..8d7bef2 100644 --- a/cogs/info.py +++ b/cogs/info.py @@ -10,8 +10,9 @@ class Info(discord.Cog): def __init__(self, bot: discord.Bot): self.bot = bot - @slash_command(aliases=["information", "ping", "latency", "pong", "servers", "guilds", "support", "invite"], description="Displays information about Pingernos") + @slash_command() async def info(self, ctx): + """ Displays information about Pingernos """ embed = Embed() try: stat = await wait_for(get_server_status("example.aternos.me"), timeout=2) diff --git a/cogs/setserver.py b/cogs/setserver.py index b52aea5..e82811d 100644 --- a/cogs/setserver.py +++ b/cogs/setserver.py @@ -10,9 +10,10 @@ class SetServer(discord.Cog): def __init__(self, bot: discord.Bot): self.bot = bot - @slash_command(aliases=["set"], description="Set the default server to use if no argument is provided in the status command.") + @slash_command() @commands.has_permissions(manage_guild=True) async def setserver(self, ctx, server=None): + """ Set the default server to use if no argument is provided in the status command """ if server is None: await modifier("DELETE FROM server WHERE guild_id = %s", [ctx.guild_id]) return await ctx.respond("Default server has been removed. Use `setserver ` to set a new one.", ephemeral=True) diff --git a/cogs/status.py b/cogs/status.py index 10f2c10..57927fd 100644 --- a/cogs/status.py +++ b/cogs/status.py @@ -12,9 +12,10 @@ class Status(discord.Cog): def __init__(self, bot: discord.Bot): self.bot = bot - @slash_command(aliases=["s"], description="Get the server status") + @slash_command() @option("serverip", str, description="The Aternos-IP to check") async def status(self, ctx, serverip=None): + """ Get the server status """ if serverip is None: serverip = (await selector('SELECT server_ip FROM server WHERE guild_id = %s', [ctx.guild.id]))[0] if not serverip: From 2f5f3de6af37d8327e3f74e8bcc69b02e331f063 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 18:03:14 +0200 Subject: [PATCH 04/15] Follow naming conventions for methods --- cogs/cogs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cogs/cogs.py b/cogs/cogs.py index 4181bc9..747587c 100644 --- a/cogs/cogs.py +++ b/cogs/cogs.py @@ -12,7 +12,7 @@ def __init__(self, bot: discord.Bot): self.bot = bot self.info = get_data() - def getcogs(self, ctx) -> list: + def get_cogs(self, ctx) -> list: if ctx.interaction.user.id not in self.info['Owners']: return ["You are not an owner of the bot!"] cogs = [] @@ -22,7 +22,7 @@ def getcogs(self, ctx) -> list: return cogs @slash_command(guild_ids=get_data()['FeatureGuilds']) - async def cogs(self, ctx, action: Option(choices=["Load", "Unload", "Reload"]), cog: Option(autocomplete=getcogs)): + async def cogs(self, ctx, action: Option(choices=["Load", "Unload", "Reload"]), cog: Option(autocomplete=get_cogs)): """ Only the owners of the bot can run this command """ if ctx.author.id not in self.info['Owners']: return From 8ebecce6c085258237ebcb895485aeed4e42b4d1 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 18:13:04 +0200 Subject: [PATCH 05/15] Fix up cogs.py, use option decorator, misc changes in the command code --- cogs/cogs.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cogs/cogs.py b/cogs/cogs.py index 747587c..ab0a935 100644 --- a/cogs/cogs.py +++ b/cogs/cogs.py @@ -1,7 +1,7 @@ from os import listdir import discord -from discord import Option +from discord import option from discord.ext.commands import slash_command from utilities.data import get_data @@ -22,16 +22,16 @@ def get_cogs(self, ctx) -> list: return cogs @slash_command(guild_ids=get_data()['FeatureGuilds']) - async def cogs(self, ctx, action: Option(choices=["Load", "Unload", "Reload"]), cog: Option(autocomplete=get_cogs)): + @option("action", choices=["Load", "Unload", "Reload"]) + @option("cog", autocomplete=get_cogs) + async def cogs(self, ctx, action, cog): """ Only the owners of the bot can run this command """ if ctx.author.id not in self.info['Owners']: - return + return await ctx.respond("This command is for owners only.", ephemeral=True) if cog.lower() not in [f"{fn[:-3]}" for fn in listdir("./cogs")]: - await ctx.respond("That cog doesn't exist!") - return - if action.lower() not in ["load", "unload", "reload"]: - await ctx.respond("That action doesn't exist!") - return + return await ctx.respond("That cog doesn't exist!") + if action not in ["Load", "Unload", "Reload"]: + return await ctx.respond("That action doesn't exist!") await ctx.defer() try: if action == "Load": From ec7ef42bf3eae93cbd9b0f9d1bd28ef03634fc90 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 18:27:44 +0200 Subject: [PATCH 06/15] Minor change so if clauses are equal, commands are now mentioned --- cogs/setserver.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/cogs/setserver.py b/cogs/setserver.py index e82811d..01b3be7 100644 --- a/cogs/setserver.py +++ b/cogs/setserver.py @@ -1,5 +1,5 @@ import discord -from discord import slash_command +from discord import slash_command, option from discord.ext import commands from utilities.database import modifier @@ -12,17 +12,18 @@ def __init__(self, bot: discord.Bot): @slash_command() @commands.has_permissions(manage_guild=True) - async def setserver(self, ctx, server=None): + @option("server", description="The server to set as default", default=None) + async def setserver(self, ctx, server): """ Set the default server to use if no argument is provided in the status command """ - if server is None: + if not server: await modifier("DELETE FROM server WHERE guild_id = %s", [ctx.guild_id]) - return await ctx.respond("Default server has been removed. Use `setserver ` to set a new one.", ephemeral=True) + return await ctx.respond(f"Default server has been removed. Use with the \"server\" option to set a new one.", ephemeral=True) server = check_ip(server) if not server: return await ctx.respond("Please provide a valid Aternos IP.", ephemeral=True) - await modifier("INSERT INTO server (guild_id, server_ip) VALUES (%s, %s) ON DUPLICATE KEY UPDATE server_ip = %s", [ctx.guild_id, server, server]) - await ctx.respond(f'The IP has been set to {server}. Use `status` without an argument to view it.' , ephemeral=True) + status_command = self.bot.get_application_command("status") + await ctx.respond(f'The IP has been set to {server}. Use without an argument to view it.', ephemeral=True) def setup(bot: discord.Bot): From e2885651b1bc6152b9dc36a9b6a25dbaef8baed3 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 19:00:45 +0200 Subject: [PATCH 07/15] Command mention and minor option & if change --- cogs/status.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/cogs/status.py b/cogs/status.py index 57927fd..8be5db2 100644 --- a/cogs/status.py +++ b/cogs/status.py @@ -13,13 +13,14 @@ def __init__(self, bot: discord.Bot): self.bot = bot @slash_command() - @option("serverip", str, description="The Aternos-IP to check") - async def status(self, ctx, serverip=None): + @option("serverip", str, description="The Aternos-IP to check", default=None) + async def status(self, ctx, serverip): """ Get the server status """ - if serverip is None: + if not serverip: serverip = (await selector('SELECT server_ip FROM server WHERE guild_id = %s', [ctx.guild.id]))[0] if not serverip: - return await ctx.respond("Sorry, but this server does not have an IP registered. Please use `setserver` for that.", ephemeral=True) + setserver_command = self.bot.get_application_command("setserver") + return await ctx.respond(f"Sorry, but this server does not have an IP registered. Please use for that.", ephemeral=True) serverip = check_ip(serverip) if not serverip: return await ctx.respond("Please provide a valid Aternos IP.", ephemeral=True) From ce3a679bebc457dd089fbd85db15cbff4416599b Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 19:13:43 +0200 Subject: [PATCH 08/15] Make log show correct amount of shards --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index d265b2e..514aa38 100644 --- a/main.py +++ b/main.py @@ -31,7 +31,7 @@ async def on_ready(): print("Reconnect(?)") if not BOOTED: # await bot.sync_commands() #You might need to uncomment this if the slash commands aren't appearing - print(f'Logged in as {bot.user} with {bot.shard_count+1} shards!') + print(f'Logged in as {bot.user} with {bot.shard_count} shards!') print('------') for shard in bot.shards: await bot.change_presence(status=Status.online, activity=Activity(type=ActivityType.watching, name=f"Aternos | Shard: {shard+1}"), shard_id=shard) From 0c310ee39bccdd0ece3efbcae60bfbb99bde817b Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 19:18:25 +0200 Subject: [PATCH 09/15] Unnecessary return type hint --- utilities/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/database.py b/utilities/database.py index e3f06ea..418a459 100644 --- a/utilities/database.py +++ b/utilities/database.py @@ -35,7 +35,7 @@ async def selector(query: str, variables: list): return result -async def modifier(query: str, variables: list) -> None: +async def modifier(query: str, variables: list): """ This function is used to modify data in the database. It is used for INSERT, UPDATE, and DELETE queries. :param query: The query to execute. Use %s for variables. Example: "INSERT INTO table (column) VALUES (%s)" From cff1aecae10360551d3f37d0e9a1e228d1811d5f Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 19:19:10 +0200 Subject: [PATCH 10/15] Make owner-only error ephemeral --- cogs/error.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cogs/error.py b/cogs/error.py index a5a4613..e841f6d 100644 --- a/cogs/error.py +++ b/cogs/error.py @@ -21,7 +21,7 @@ async def on_application_command_error(self, ctx, error): if not ctx.guild: return await ctx.respond("This command can only be used in a server.", ephemeral=True) if isinstance(error, commands.NotOwner): - return await ctx.respond("This command is for owners only.") + return await ctx.respond("This command is for owners only.", ephemeral=True) if isinstance(error, commands.GuildNotFound): return await ctx.respond("Could not find this guild.") await ctx.respond("An unknown error has occurred!\nThis has been logged") From 950b5b69524d33dd61d59d06828dff9aeb81fda6 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Wed, 10 Apr 2024 19:42:59 +0200 Subject: [PATCH 11/15] Correct typehint --- utilities/utility.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/utility.py b/utilities/utility.py index bbf6173..59576f9 100644 --- a/utilities/utility.py +++ b/utilities/utility.py @@ -1,7 +1,7 @@ import re -def check_ip(server: str) -> str: +def check_ip(server: str) -> str | bool: if not server.endswith('.aternos.me'): server += '.aternos.me' regex = re.compile(r"\w+\.aternos\.me") From 580bbf85970f6a0dec06186220918c5658855764 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Thu, 11 Apr 2024 18:39:12 +0200 Subject: [PATCH 12/15] Add back return type --- utilities/database.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utilities/database.py b/utilities/database.py index 418a459..31284a8 100644 --- a/utilities/database.py +++ b/utilities/database.py @@ -1,7 +1,6 @@ from mysql import connector as mysql from utilities.data import get_data - async def mysql_login(): """ This function is used to log in to the database. @@ -35,7 +34,7 @@ async def selector(query: str, variables: list): return result -async def modifier(query: str, variables: list): +async def modifier(query: str, variables: list) -> None: """ This function is used to modify data in the database. It is used for INSERT, UPDATE, and DELETE queries. :param query: The query to execute. Use %s for variables. Example: "INSERT INTO table (column) VALUES (%s)" From 22bef5217458d69765ec8e10f955cda9e2b83a16 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Thu, 11 Apr 2024 19:09:34 +0200 Subject: [PATCH 13/15] Quick added line for pep8 confirmity --- utilities/database.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/utilities/database.py b/utilities/database.py index 31284a8..aedc541 100644 --- a/utilities/database.py +++ b/utilities/database.py @@ -1,6 +1,8 @@ +import mysql as my from mysql import connector as mysql from utilities.data import get_data + async def mysql_login(): """ This function is used to log in to the database. From 97780aa2d6cbe6a4802543de325386395e563169 Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Thu, 11 Apr 2024 19:11:06 +0200 Subject: [PATCH 14/15] Don't push test code --- utilities/database.py | 1 - 1 file changed, 1 deletion(-) diff --git a/utilities/database.py b/utilities/database.py index aedc541..e3f06ea 100644 --- a/utilities/database.py +++ b/utilities/database.py @@ -1,4 +1,3 @@ -import mysql as my from mysql import connector as mysql from utilities.data import get_data From b87a1d1317b94f8337fc2327d9c2b3c72d2a375f Mon Sep 17 00:00:00 2001 From: ToothyDev Date: Thu, 11 Apr 2024 19:16:36 +0200 Subject: [PATCH 15/15] Add typehint to selector --- utilities/database.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utilities/database.py b/utilities/database.py index e3f06ea..227a82f 100644 --- a/utilities/database.py +++ b/utilities/database.py @@ -16,7 +16,7 @@ async def mysql_login(): database=database['Database']) -async def selector(query: str, variables: list): +async def selector(query: str, variables: list) -> tuple: """ This function is used to select data from the database. It is used for SELECT queries. :param query: The query to execute. Use %s for variables. Example: "SELECT * FROM table WHERE column = %s"