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

Add delay kwarg to message.delete() #2094

Closed
wants to merge 2 commits into from

Conversation

@Vexs
Copy link
Contributor

commented Apr 17, 2019

Summary

This PR adds a delay kwarg to message.delete that delays the deletion of a message while yielding back to the event loop. This is the same behavior used in delete_after kwargs, but for more generic usage. It also refactors existing delete_after behaviors to use the new kwarg.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)
Add delay kwarg to message.delete()
Refactor delete_after kwargs to use new delay kwarg
@Rapptz
Copy link
Owner

left a comment

Not sure I'm too keen on the wording. The kwarg is delete_after not delete_delay but await x.delete(after=30.0) is different from after used elsewhere in the lib (i.e. a callback). I suppose the naming itself is fine.

@@ -563,7 +563,7 @@ def system_content(self):
else:
return '{0.author.name} started a call \N{EM DASH} Join the call.'.format(self)

async def delete(self):
async def delete(self, delay=None):

This comment has been minimized.

Copy link
@Rapptz

Rapptz Apr 18, 2019

Owner
Suggested change
async def delete(self, delay=None):
async def delete(self, *, delay=None):

This needs to be a keyword only argument. await m.delete(10.0) is bad readability and could be ambiguous in the future.

Also, it needs an addition in the docstring.

.. versionadded:: 1.1.0
   The ``delay`` keyword-only parameter.

This comment has been minimized.

Copy link
@Vexs

Vexs Apr 18, 2019

Author Contributor

Oh bugger I completely forgot. Yes, this should be that.

@Rapptz Rapptz added this to the v1.1 milestone Apr 18, 2019

@Rapptz Rapptz added the rebased label Apr 18, 2019

@Rapptz

Rapptz approved these changes Apr 18, 2019

@Rapptz Rapptz closed this Apr 18, 2019

@Vexs Vexs deleted the Vexs:delete_delay branch Apr 19, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.