Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Effectuer une gestion centralisée de la logique d'envoi (reply/send/editReply/followup) côté discord #2730

Open
romain22222 opened this issue Jan 21, 2025 · 3 comments
Labels
Discord Stuff that is specific to the interactions with discord refactoring No visible changes but code improved
Milestone

Comments

@romain22222
Copy link
Member

Pour le moment, à chaque handle de fonction différent, on doit se demander dans quel cas d'envoi on se retrouve. C'est bien quand le handler est appelable qu'à un endroit du code et dont on sait ce qui a déjà été fait. Mais il y a plein d'endroits (switch success, l'handle des errors générique, commande report, ...) dont on ne peut vraiment savoir exactement ce qui a été fait, ce qui peut créer au choix un deferReply sans réponse (relativement bénin), un editReply sur un message qui n'est pas censé l'être (un peu plus contraignant) voir un reply dans un contexte où le reply est impossible ( dans ce cas erreur d'affichage, et si bloquage il y a eu, bloquage il faudra attendre).

Je propose donc de centraliser cette logique au sein d'une fonction mère qu'on nommerait "interaction.reply" (donc répondre) et qui se chargerait de choisir la bonne fonction à utiliser pour répondre (au choix : reply/editReply/followUp/send, et de même sur la buttonInteraction du context, soit 8 possibilités). Si l'on veut orienter cette fonction mère à choisir une certaine fonction (je pense par exemple à la commande report qui a de souvenir quelques sends) on pourrait passer en paramètre cette indication.

@romain22222 romain22222 added Discord Stuff that is specific to the interactions with discord refactoring No visible changes but code improved labels Jan 21, 2025
@romain22222 romain22222 added this to the DraftBot V5 milestone Jan 21, 2025
@romain22222
Copy link
Member Author

Exemple typique de gestions à centraliser :

Image

@Feiryn
Copy link
Contributor

Feiryn commented Jan 25, 2025

@Feiryn
Copy link
Contributor

Feiryn commented Jan 25, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discord Stuff that is specific to the interactions with discord refactoring No visible changes but code improved
Projects
None yet
Development

No branches or pull requests

2 participants