Skip to content

Conversation

@NeloBlivion
Copy link
Member

@NeloBlivion NeloBlivion commented Oct 4, 2022

Summary

Since delete_message_seconds default was changed to None, you run into a TypeError when it isn't passed in.

> await member.ban()

File ".../venv/lib/python3.8/site-packages/discord/member.py", line 665, in ban
  await self.guild.ban(self, reason=reason, delete_message_days=delete_message_days)
File ".../venv/lib/python3.8/site-packages/discord/guild.py", line 2973, in ban
  if not (0 <= delete_message_seconds <= 604800):
TypeError: '<=' not supported between instances of 'int' and 'NoneType'

As such, the default is changed back to 0. Regarding a concern raised in the original PR, if the defaults are 0 then the data won't be set anyway.

        if delete_message_seconds:
            params["delete_message_seconds"] = delete_message_seconds
        elif delete_message_days:
            warn_deprecated(...)
            params["delete_message_days"] = delete_message_days

This PR also updates Member.ban to support delete_message_seconds as it seemed to be untouched... as such, all member.ban calls in 2.2.0 may currently be broken.

> await member.ban(delete_message_seconds=0)
TypeError: Member.ban() got an unexpected keyword argument 'delete_message_seconds'

Information

  • 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, typehinting, examples, ...).

Checklist

  • I have searched the open pull requests for duplicates.
  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • If type: ignore comments were used, a comment is also left explaining why.

@BobDotCom BobDotCom enabled auto-merge (squash) October 4, 2022 15:06
@BobDotCom BobDotCom merged commit d5c59ea into Pycord-Development:master Oct 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants