Skip to content

Commit

Permalink
-object type test related to github issue modmail-dev#3131 related to…
Browse files Browse the repository at this point in the history
… blocked users.
  • Loading branch information
TJZine committed May 1, 2022
1 parent b31a32c commit 8cfca1c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -1469,6 +1469,9 @@ async def blocked(self, ctx):
roles = []
users = []
now = ctx.message.created_at
print("Now Date Object:")
print(type(now))
print(now)

blocked_users = list(self.bot.blocked_users.items())
for id_, reason in blocked_users:
Expand All @@ -1485,6 +1488,7 @@ async def blocked(self, ctx):
)

if end_time is not None:
print(datetime.fromisoformat(end_time.group(1)))
after = (datetime.fromisoformat(end_time.group(1)) - now).total_seconds()
if after <= 0:
# No longer blocked
Expand Down
2 changes: 1 addition & 1 deletion core/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ async def send(
not prioritize_uploads or ((url is None or is_image_url(url)) and filename)
) and not embedded_image:
if url is not None:
embed.add_field(name="Image2", value=f"({url}) UPLOADED2")
embed.add_field(name="Image2", value=f"{url} UPLOADED2")
embed.set_image(url=url)
if filename:
if is_sticker:
Expand Down
8 changes: 7 additions & 1 deletion core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,13 @@ def is_image_url(url: str, **kwargs) -> str:
# gyazo support
url = re.sub(
r"(http[s]?:\/\/)((?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)",
r"\1i.\2.png",
r"\1i.\2.gif",
url,
)
elif url.startswith("https://imgur.com") or url.startswith("http://imgur.com"):
url = re.sub(
r"(http[s]?:\/\/)((?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*(),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+)",
r"\1i.\2.jpg",
url,
)

Expand Down

0 comments on commit 8cfca1c

Please sign in to comment.