diff --git a/techsupport_bot/commands/config.py b/techsupport_bot/commands/config.py index e9f8470e..9c5e1397 100644 --- a/techsupport_bot/commands/config.py +++ b/techsupport_bot/commands/config.py @@ -279,9 +279,11 @@ async def reset_config(self: Self, interaction: discord.Interaction) -> None: Args: interaction (discord.Interaction): The interaction that triggered the slash command """ + await interaction.response.defer() view = ui.Confirm() await view.send( message=f"Are you sure you want to reset the config for {interaction.guild.name}?", + channel=interaction.channel, author=interaction.user, interaction=interaction, ) @@ -303,4 +305,4 @@ async def reset_config(self: Self, interaction: discord.Interaction) -> None: embed = auxiliary.prepare_confirm_embed( message="I've reset the config for this guild" ) - view.followup.send(embed=embed) + await view.followup.send(embed=embed) diff --git a/techsupport_bot/commands/dictionary.py b/techsupport_bot/commands/dictionary.py index 69209dc2..23566eea 100644 --- a/techsupport_bot/commands/dictionary.py +++ b/techsupport_bot/commands/dictionary.py @@ -66,15 +66,21 @@ async def dictionary_lookup( response = await self.bot.http_functions.http_call("get", url) if not response: embed = auxiliary.prepare_deny_embed( - f"I could not find any definition for `{word}`" + f"I could not find any information for `{word}`" ) await interaction.followup.send(embed=embed) return - definition = response[0].shortdef - - embed = discord.Embed(title=f"Definition of `{word}`") - embed.color = discord.Color.orange() - embed.description = "\n".join(f"- {string}" for string in definition) + try: + definition = response[0].shortdef + embed = discord.Embed(title=f"Definition of `{word}`") + embed.color = discord.Color.orange() + embed.description = "\n".join(f"- {string}" for string in definition) + except AttributeError: + embed = discord.Embed( + title=f"The word `{word}` was not found. Did you mean:" + ) + embed.description = ", ".join(response) + embed.color = discord.Color.orange() await interaction.followup.send(embed=embed) diff --git a/techsupport_bot/commands/duck.py b/techsupport_bot/commands/duck.py index c22690c7..8b6f088a 100644 --- a/techsupport_bot/commands/duck.py +++ b/techsupport_bot/commands/duck.py @@ -899,7 +899,7 @@ async def spawn(self: Self, ctx: commands.Context) -> None: spawn_user = configuration.get_config_entry(ctx.guild.id, "duck_spawn_user") for person in spawn_user: if ctx.author.id == int(person): - await self.execute(ctx.guild, ctx.channel) + await self.execute(ctx.guild, ctx.channel, ctx.author) return await auxiliary.send_deny_embed( message="It looks like you don't have permissions to spawn a duck", diff --git a/techsupport_bot/commands/extension.py b/techsupport_bot/commands/extension.py index 1cee1d43..3373af35 100644 --- a/techsupport_bot/commands/extension.py +++ b/techsupport_bot/commands/extension.py @@ -211,11 +211,12 @@ async def register_extension( extension_name (str): the name of the extension extension_file (discord.Attachment): The python file of the extension """ + await interaction.response.defer() if not extension_file.filename.endswith(".py"): embed = auxiliary.prepare_deny_embed( message="I don't recognize your upload as a Python file", ) - await interaction.response.send_message(embed=embed) + await interaction.followup.send(embed=embed) return if extension_name.lower() in await self.bot.get_potential_extensions(): @@ -223,6 +224,7 @@ async def register_extension( await view.send( message=f"Warning! This will replace the current `{extension_name}.py` " + "extension! Are you SURE?", + channel=interaction.channel, author=interaction.user, interaction=interaction, ) @@ -239,10 +241,10 @@ async def register_extension( fp = await extension_file.read() await self.bot.register_file_extension(extension_name, fp) - embed = auxiliary.send_confirm_embed( + embed = auxiliary.prepare_confirm_embed( message="I've registered that extension. You can now try loading it", ) - await view.followup.send(embed=embed) + await interaction.followup.send(embed=embed) return async def does_extension_exist(self: Self, extension_name: str) -> bool: diff --git a/techsupport_bot/commands/factoids.py b/techsupport_bot/commands/factoids.py index 8fd993e4..db55a5a2 100644 --- a/techsupport_bot/commands/factoids.py +++ b/techsupport_bot/commands/factoids.py @@ -1028,6 +1028,8 @@ async def factoid_call_command( content = factoid.message if member_to_ping: + if not content: + content = "" content = f"{member_to_ping.mention} {content}".strip() if content and len(content) > 2000: diff --git a/techsupport_bot/commands/relay.py b/techsupport_bot/commands/relay.py index 91d72ad3..ad0bef05 100644 --- a/techsupport_bot/commands/relay.py +++ b/techsupport_bot/commands/relay.py @@ -411,6 +411,8 @@ async def send_message_from_irc(self: Self, split_message: dict[str, str]) -> No if "automod" in configuration.get_config_entry( discord_channel.guild.id, "core_enabled_extensions" + ) and str(discord_channel.id) in configuration.get_config_entry( + discord_channel.guild.id, "automod_channels" ): automod_actions = automod.run_only_string_checks( discord_channel.guild, split_message["content"] diff --git a/techsupport_bot/commands/search.py b/techsupport_bot/commands/search.py index 62211091..ec9d218c 100644 --- a/techsupport_bot/commands/search.py +++ b/techsupport_bot/commands/search.py @@ -46,7 +46,7 @@ class WebSearcher(cogs.BaseCog): name="search", description="Command Group for the Search Extension" ) - async def make_reqest(self: Self, query: str) -> munch.Munch: + async def make_request(self: Self, query: str) -> munch.Munch: """This functions make a request to the Tavily API This pulls the API key from the config and returns a munch.Munch result @@ -94,7 +94,7 @@ async def websearch_text( query (str): The string query passed in by the user """ await interaction.response.defer() - response = self.make_request(query) + response = await self.make_request(query) embeds = [] @@ -134,7 +134,7 @@ async def websearch_image( query (str): The string query passed in by the user """ await interaction.response.defer() - response = self.make_request(query) + response = await self.make_request(query) embeds = [] diff --git a/techsupport_bot/configuration/config.default.json b/techsupport_bot/configuration/config.default.json index f578e87e..e0c90ef2 100644 --- a/techsupport_bot/configuration/config.default.json +++ b/techsupport_bot/configuration/config.default.json @@ -82,7 +82,7 @@ "modmail_modmail_roles": [], "modmail_roles_to_ping": [], "modmail_thread_creation_message": "Create modmail thread?", - "news_category": "", + "news_category": "general", "news_channel": "", "news_country": "US", "news_cron_config": "0 17 * * *", diff --git a/techsupport_bot/core/cogs.py b/techsupport_bot/core/cogs.py index 3038a938..0cacd5f3 100644 --- a/techsupport_bot/core/cogs.py +++ b/techsupport_bot/core/cogs.py @@ -342,10 +342,11 @@ async def _loop_execute( if guild and guild not in self.bot.guilds: break - channels_list = configuration.get_config_entry( - guild.id, self.CHANNELS_KEY - ) - if not channels_list: + try: + channels_list = configuration.get_config_entry( + guild.id, self.CHANNELS_KEY + ) + except AttributeError: channels_list = [] if target_channel and str(target_channel.id) not in channels_list: diff --git a/techsupport_bot/functions/autoreact.py b/techsupport_bot/functions/autoreact.py index d431954d..b19dc301 100644 --- a/techsupport_bot/functions/autoreact.py +++ b/techsupport_bot/functions/autoreact.py @@ -60,5 +60,5 @@ async def response( if f" {word.lower()} " in search_content: reaction = reaction_map.get(word) if reaction not in reactions: - reactions.append(reaction_map.value.get(word)) + reactions.append(reaction_map.get(word)) await auxiliary.add_list_of_reactions(message=ctx.message, reactions=reactions)