Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion techsupport_bot/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand All @@ -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)
18 changes: 12 additions & 6 deletions techsupport_bot/commands/dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion techsupport_bot/commands/duck.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 5 additions & 3 deletions techsupport_bot/commands/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,18 +211,20 @@ 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():
view = ui.Confirm()
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,
)
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions techsupport_bot/commands/factoids.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions techsupport_bot/commands/relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
6 changes: 3 additions & 3 deletions techsupport_bot/commands/search.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 = []

Expand Down Expand Up @@ -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 = []

Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/configuration/config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 * * *",
Expand Down
9 changes: 5 additions & 4 deletions techsupport_bot/core/cogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion techsupport_bot/functions/autoreact.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading