check if DM are closed and don't stop at first error
This commit is contained in:
parent
dac6ed6112
commit
abd62d7c6d
1 changed files with 5 additions and 2 deletions
|
@ -34,10 +34,13 @@ class ToDoDiscord(commands.Cog, name="Todo"):
|
|||
for todo in todos:
|
||||
user = self.client.get_user(todo[0])
|
||||
if user == None: # si l'utilisateur n'est pas trouvé
|
||||
return # on ignore l'utilisateur
|
||||
pass # on ignore l'utilisateur
|
||||
channel = await user.create_dm() # envoie en DM
|
||||
embed, pageMAX = await embedListeToDo(user, 1)
|
||||
message = await channel.send("Récapitulatif hebdomadaire de vos To Do's", embed = embed)
|
||||
try:
|
||||
message = await channel.send("Récapitulatif hebdomadaire de vos To Do's", embed = embed)
|
||||
except: # Les DM sont fermés
|
||||
pass # on ignore l'envoie du récap
|
||||
if pageMAX > 1:
|
||||
for emoji in ["⬅️", "➡️"]:
|
||||
await message.add_reaction(emoji)
|
||||
|
|
Reference in a new issue