Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Borketh committed Dec 19, 2024
2 parents 75ae64e + 062143d commit f215c67
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 204 deletions.
5 changes: 4 additions & 1 deletion fred/cogs/crashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ def formatted_chunks_of_100_mod_references() -> Generator[str, None, None]:
for mod in queried_mods:
mod_name = mod["name"]
mod_compat = mod["compatibility"]
if mod_compat is None:
continue # we have no way of knowing
compat_info = mod_compat.get("EA") or mod_compat.get("EXP")
mod_latest_version = Version.parse(mod["versions"][0]["version"])

Expand Down Expand Up @@ -391,7 +393,8 @@ async def process_message(self, message: Message) -> bool:
embed = createembed.crashes(filtered_responses)
embed.set_author(
name=f"Automated responses for {message.author.global_name or message.author.display_name} ({message.author.id})",
icon_url=message.author.avatar.url,
icon_url=message.author.avatar and message.author.avatar.url,
# defaults to None if no avatar, like mircea
)
await self.bot.reply_to_msg(message, embed=embed, propagate_reply=False)
return True
Expand Down
10 changes: 6 additions & 4 deletions fred/fred.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,20 @@ async def send_DM(
self.logger.info("The user refuses to have DMs sent to them")
return False

if not user.dm_channel:
await user.create_dm()

try:

if not user.dm_channel:
await user.create_dm()

if not embed:
embed = createembed.DM(content)
content = None

await user.dm_channel.send(content=content, embed=embed, **kwargs)
return True
except Exception: # noqa
self.logger.error(f"DMs: Failed to DM, reason: \n{traceback.format_exc()}")
return False
return False

async def checked_DM(self, user: nextcord.User, **kwargs) -> bool:
user_meta = config.Users.create_if_missing(user)
Expand Down
4 changes: 3 additions & 1 deletion fred/libraries/createembed.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ async def webp_icon_as_png(url: str, bot: Bot) -> tuple[nextcord.File, str]:


# SMR Lookup Embed Formats
async def mod_embed(name: str, bot: Bot, using_id = False) -> tuple[nextcord.Embed | None, nextcord.File | None, list[dict] | None]:
async def mod_embed(
name: str, bot: Bot, using_id=False
) -> tuple[nextcord.Embed | None, nextcord.File | None, list[dict] | None]:
# GraphQL Queries
# fmt: off
query_values = '''
Expand Down
Loading

0 comments on commit f215c67

Please sign in to comment.