Skip to content

Commit 9eb74be

Browse files
committed
Revert "use silent as typing literal, resolve modmail-dev#3179"
This reverts commit f6395aa.
1 parent fd505ba commit 9eb74be

File tree

1 file changed

+10
-18
lines changed

1 file changed

+10
-18
lines changed

cogs/modmail.py

+10-18
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import re
33
from datetime import datetime
44
from itertools import zip_longest
5-
from typing import Optional, Union, List, Tuple, Literal
5+
from typing import Optional, Union
66
from types import SimpleNamespace
77

88
import discord
@@ -1344,11 +1344,9 @@ async def selfcontact(self, ctx):
13441344
async def contact(
13451345
self,
13461346
ctx,
1347-
users: commands.Greedy[
1348-
Union[Literal["silent", "silently"], discord.Member, discord.User, discord.Role]
1349-
],
1347+
users: commands.Greedy[Union[discord.Member, discord.User, discord.Role]],
13501348
*,
1351-
category: SimilarCategoryConverter = None,
1349+
category: Union[SimilarCategoryConverter, str] = None,
13521350
manual_trigger=True,
13531351
):
13541352
"""
@@ -1362,22 +1360,16 @@ async def contact(
13621360
A maximum of 5 users are allowed.
13631361
`options` can be `silent` or `silently`.
13641362
"""
1365-
silent = any(x in users for x in ("silent", "silently"))
1366-
if silent:
1367-
try:
1368-
users.remove("silent")
1369-
except ValueError:
1370-
pass
1371-
1372-
try:
1373-
users.remove("silently")
1374-
except ValueError:
1375-
pass
1376-
1377-
print(users, silent)
1363+
silent = False
13781364
if isinstance(category, str):
13791365
category = category.split()
13801366

1367+
# just check the last element in the list
1368+
if category[-1].lower() in ("silent", "silently"):
1369+
silent = True
1370+
# remove the last element as we no longer need it
1371+
category.pop()
1372+
13811373
category = " ".join(category)
13821374
if category:
13831375
try:

0 commit comments

Comments
 (0)