Skip to content

Commit

Permalink
Merge pull request #143 from satisfactorymodding/dev
Browse files Browse the repository at this point in the history
2.22.7
  • Loading branch information
Feyko authored Sep 22, 2024
2 parents 8a30b21 + 0c0a6d2 commit 0fc056e
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion fred/cogs/crashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion fred/fred.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 4 additions & 1 deletion fred/fred_commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion fred/fred_commands/dbcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}'")
Expand Down
9 changes: 6 additions & 3 deletions fred/libraries/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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 <feykook@gmail.com>", "Mircea Roata <mircearoatapalade@yahoo.ro>", "Borketh <does.not.kompute@gmail.com>"]
license = "MIT License"
Expand Down

0 comments on commit 0fc056e

Please sign in to comment.