2
2
import re
3
3
from datetime import datetime
4
4
from itertools import zip_longest
5
- from typing import Optional , Union , List , Tuple , Literal
5
+ from typing import Optional , Union
6
6
from types import SimpleNamespace
7
7
8
8
import discord
@@ -1344,11 +1344,9 @@ async def selfcontact(self, ctx):
1344
1344
async def contact (
1345
1345
self ,
1346
1346
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 ]],
1350
1348
* ,
1351
- category : SimilarCategoryConverter = None ,
1349
+ category : Union [ SimilarCategoryConverter , str ] = None ,
1352
1350
manual_trigger = True ,
1353
1351
):
1354
1352
"""
@@ -1362,22 +1360,16 @@ async def contact(
1362
1360
A maximum of 5 users are allowed.
1363
1361
`options` can be `silent` or `silently`.
1364
1362
"""
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
1378
1364
if isinstance (category , str ):
1379
1365
category = category .split ()
1380
1366
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
+
1381
1373
category = " " .join (category )
1382
1374
if category :
1383
1375
try :
0 commit comments