Rapptz / discord-ext-menus

MIT License
234 stars 87 forks source link

stop adding reactions when the menu is stopped #7

Closed ioistired closed 4 years ago

ioistired commented 4 years ago

This commit fixes a bug where, given a menu with clear_reactions_after=True, stopping the paginator before the rest of the reactions are added causes them to be added anyway.

Now, the adding of reactions is moved into a task, and cancelled when the menu is stopped.

diceroll123 commented 4 years ago

if self.__tasks:

Could just while self.__tasks: to loop through + pop them + cancel the popped values

avayert commented 4 years ago

if self.__tasks:

Could just while self.__tasks: to loop through + pop them + cancel the popped values

The whole if statement seems superfluous, as the body alone would achieve the same thing. The only thing it changes is clear() being called on an empty list, which is only nanoseconds slower than the conditional in the first place.

ioistired commented 4 years ago

Resolved in latest force push.