Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.23.1 - Fixes for some problems preventing log parse #162

Merged
merged 4 commits into from
Dec 19, 2024
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
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
Loading