Skip to content

Commit

Permalink
Revert "use silent as typing literal, resolve modmail-dev#3179"
Browse files Browse the repository at this point in the history
This reverts commit f6395aa.
  • Loading branch information
Erisa committed Sep 11, 2022
1 parent fd505ba commit 9eb74be
Showing 1 changed file with 10 additions and 18 deletions.
28 changes: 10 additions & 18 deletions cogs/modmail.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import re
from datetime import datetime
from itertools import zip_longest
from typing import Optional, Union, List, Tuple, Literal
from typing import Optional, Union
from types import SimpleNamespace

import discord
Expand Down Expand Up @@ -1344,11 +1344,9 @@ async def selfcontact(self, ctx):
async def contact(
self,
ctx,
users: commands.Greedy[
Union[Literal["silent", "silently"], discord.Member, discord.User, discord.Role]
],
users: commands.Greedy[Union[discord.Member, discord.User, discord.Role]],
*,
category: SimilarCategoryConverter = None,
category: Union[SimilarCategoryConverter, str] = None,
manual_trigger=True,
):
"""
Expand All @@ -1362,22 +1360,16 @@ async def contact(
A maximum of 5 users are allowed.
`options` can be `silent` or `silently`.
"""
silent = any(x in users for x in ("silent", "silently"))
if silent:
try:
users.remove("silent")
except ValueError:
pass

try:
users.remove("silently")
except ValueError:
pass

print(users, silent)
silent = False
if isinstance(category, str):
category = category.split()

# just check the last element in the list
if category[-1].lower() in ("silent", "silently"):
silent = True
# remove the last element as we no longer need it
category.pop()

category = " ".join(category)
if category:
try:
Expand Down

0 comments on commit 9eb74be

Please sign in to comment.