3
3
from datetime import datetime , timezone
4
4
from itertools import zip_longest
5
5
import time
6
- from typing import Optional , Union , List , Tuple
6
+ from typing import Optional , Union , List , Tuple , Literal
7
7
from types import SimpleNamespace
8
8
9
9
import discord
@@ -1500,9 +1500,9 @@ async def selfcontact(self, ctx):
1500
1500
async def contact (
1501
1501
self ,
1502
1502
ctx ,
1503
- users : commands .Greedy [Union [discord .Member , discord .User , discord .Role ]],
1503
+ users : commands .Greedy [Union [Literal [ "silent" , "silently" ], discord .Member , discord .User , discord .Role ]],
1504
1504
* ,
1505
- category : Union [ SimilarCategoryConverter , str ] = None ,
1505
+ category : SimilarCategoryConverter = None ,
1506
1506
manual_trigger = True ,
1507
1507
):
1508
1508
"""
@@ -1516,16 +1516,22 @@ async def contact(
1516
1516
A maximum of 5 users are allowed.
1517
1517
`options` can be `silent` or `silently`.
1518
1518
"""
1519
- silent = False
1519
+ silent = any (x in users for x in ("silent" , "silently" ))
1520
+ if silent :
1521
+ try :
1522
+ users .remove ("silent" )
1523
+ except ValueError :
1524
+ pass
1525
+
1526
+ try :
1527
+ users .remove ("silently" )
1528
+ except ValueError :
1529
+ pass
1530
+
1531
+ print (users , silent )
1520
1532
if isinstance (category , str ):
1521
1533
category = category .split ()
1522
1534
1523
- # just check the last element in the list
1524
- if category [- 1 ].lower () in ("silent" , "silently" ):
1525
- silent = True
1526
- # remove the last element as we no longer need it
1527
- category .pop ()
1528
-
1529
1535
category = " " .join (category )
1530
1536
if category :
1531
1537
try :
0 commit comments