ui(reminders): Rework user interface.

This commit is contained in:
2023-09-13 02:33:49 +03:00
parent e164e3ec7b
commit 0e8512b971
6 changed files with 698 additions and 533 deletions

View File

@@ -812,3 +812,20 @@ def recurse_map(func, obj, loc=[]):
else:
obj = func(loc, obj)
return obj
async def check_dm(user: discord.User | discord.Member) -> bool:
"""
Check whether we can direct message the given user.
Assumes the client is initialised.
This uses an always-failing HTTP request,
so we need to be very very very careful that this is not used frequently.
Optimally only at the explicit behest of the user
(i.e. during a user instigated interaction).
"""
try:
await user.send('')
except discord.Forbidden:
return False
except discord.HTTPException:
return True