diff --git a/fred/cogs/crashes.py b/fred/cogs/crashes.py index 2d3bbf5..14dd277 100644 --- a/fred/cogs/crashes.py +++ b/fred/cogs/crashes.py @@ -382,6 +382,7 @@ async def process_message(self, message: Message) -> bool: await self.bot.reply_to_msg( message, f"{filtered_responses[0].value}\n-# Responding to `{filtered_responses[0].name}` triggered by {message.author.mention}", + propagate_reply=False, ) else: @@ -392,7 +393,7 @@ async def process_message(self, message: Message) -> bool: name=f"Automated responses for {message.author.global_name or message.author.display_name} ({message.author.id})", icon_url=message.author.avatar.url, ) - await self.bot.reply_to_msg(message, embed=embed) + await self.bot.reply_to_msg(message, embed=embed, propagate_reply=False) return True else: diff --git a/fred/fred.py b/fred/fred.py index 62df7e5..33cfbe8 100644 --- a/fred/fred.py +++ b/fred/fred.py @@ -18,7 +18,7 @@ from .fred_commands import Commands, FredHelpEmbed from .libraries import createembed, common -__version__ = "2.22.5" +__version__ = "2.22.7" class Bot(commands.Bot): diff --git a/fred/fred_commands/__init__.py b/fred/fred_commands/__init__.py index 21e1673..b17bbe7 100644 --- a/fred/fred_commands/__init__.py +++ b/fred/fred_commands/__init__.py @@ -64,7 +64,10 @@ async def on_command_error(self, ctx: commands.Context, error): # this is raised to escape a bunch of value passing if timed out, but should not raise big errors. return - await ctx.send("I encountered an error while trying to call this command. Feyko has been notified") + await ctx.send( + "I encountered an error while trying to call this command. " + "The error has been logged, sorry for the inconvenience." + ) raise (error.original if hasattr(error, "original") else error) @BaseCmds.listener() diff --git a/fred/fred_commands/dbcommands.py b/fred/fred_commands/dbcommands.py index cc57140..3115444 100644 --- a/fred/fred_commands/dbcommands.py +++ b/fred/fred_commands/dbcommands.py @@ -38,7 +38,7 @@ async def add_command(self, ctx: commands.Context, command_name: str.lower, *, r if not await self.bot.reply_yes_or_no(ctx.message, msg): return - config.Commands(name=command_name, content=response, attachment=attachment.url) + config.Commands(name=command_name, content=response, attachment=attachment and attachment.url) await self.bot.reply_to_msg(ctx.message, f"Command '{command_name}' added!") self.logger.info("Command {command_name} added with response '{response}'") diff --git a/fred/libraries/common.py b/fred/libraries/common.py index 48cc675..56ab5cb 100644 --- a/fred/libraries/common.py +++ b/fred/libraries/common.py @@ -5,7 +5,7 @@ from functools import lru_cache, singledispatch from typing import TYPE_CHECKING, Optional -from nextcord import User, Message, Member, Guild +from nextcord import User, Message, Member, Guild, NotFound from nextcord.ext import commands from nextcord.ext.commands import Context @@ -37,8 +37,11 @@ def __init__(self, bot: Bot): self.logger.debug("Cog loaded.") -async def get_guild_member(guild: Guild, user_id: int) -> Member: - return guild.get_member(user_id) or await guild.fetch_member(user_id) +async def get_guild_member(guild: Guild, user_id: int) -> Optional[Member]: + try: + return guild.get_member(user_id) or await guild.fetch_member(user_id) + except NotFound: + return None def is_bot_author(user_id: int) -> bool: diff --git a/pyproject.toml b/pyproject.toml index ea8c240..b0203c7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "fred" -version = "2.22.5" +version = "2.22.7" description = "A Discord bot for the Satisfactory Modding Discord " authors = ["Feyko ", "Mircea Roata ", "Borketh "] license = "MIT License"