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

Fix Guild Bans #279

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Fix Guild Bans #279

wants to merge 7 commits into from

Conversation

Droid00000
Copy link
Contributor

Summary

Updates the ban API call, abstractions, and inline docs, to support cleaning messages as the old delete_message_days parameter has been replaced by delete_message_seconds, and adds support for sending an X-Audit-Log-Reason header.

Fixed

No audit log reason for guild bans, and broken clean messages parameter.

lib/discordrb/data/member.rb Outdated Show resolved Hide resolved
lib/discordrb/api/server.rb Outdated Show resolved Hide resolved
lib/discordrb/data/server.rb Outdated Show resolved Hide resolved
@Droid00000
Copy link
Contributor Author

I've added back support for the message_days parameter. I've included message_seconds as an optional parameter to ease the transition to 4.0, when that eventually releases.

lib/discordrb/data/member.rb Show resolved Hide resolved
@@ -247,10 +247,17 @@ def server_unmute
end

# Bans this member from the server.
# @param message_days [Integer] How many days worth of messages sent by the member should be deleted.
# @param message_days [Integer] How many days worth of messages sent by the member should be deleted. This will be deprecated in 4.0.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this parameter be deprecated now and removed in 4.0?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per what @swarley has said in DAPI I was told to keep the argument as is and add seconds as an optional KWARG.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that comment referred to keeping it in version 3.x, not in 4.0. In semantic versioning (semver), a breaking change, like a backwards incompatible method signature change, is only allowed during major version changes, such as 3.x to 4.0. A deprecation is a warning that it will be removed in a future version, in this case likely 4.0. Therefore, it should be deprecated now and removed in 4.0, not, as the comment claims, be deprecated in 4.0, which would imply its existence in 4.0 (and thus its removal not earlier than in 5.0).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that comment referred to keeping it in version 3.x, not in 4.0. In semantic versioning (semver), a breaking change, like a backwards incompatible method signature change, is only allowed during major version changes, such as 3.x to 4.0. A deprecation is a warning that it will be removed in a future version, in this case likely 4.0. Therefore, it should be deprecated now and removed in 4.0, not, as the comment claims, be deprecated in 4.0, which would imply its existence in 4.0 (and thus its removal not earlier than in 5.0).

Oh whoops. Seems like I misunderstood what you mean.

lib/discordrb/api/server.rb Outdated Show resolved Hide resolved
lib/discordrb/data/server.rb Outdated Show resolved Hide resolved
Copy link
Contributor Author

@Droid00000 Droid00000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've made a few changes and responded to most of the comments. Please take a look whenever you have the chance. 🙇‍♂️

lib/discordrb/api/server.rb Outdated Show resolved Hide resolved
@@ -247,10 +247,17 @@ def server_unmute
end

# Bans this member from the server.
# @param message_days [Integer] How many days worth of messages sent by the member should be deleted.
# @param message_days [Integer] How many days worth of messages sent by the member should be deleted. This will be deprecated in 4.0.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per what @swarley has said in DAPI I was told to keep the argument as is and add seconds as an optional KWARG.

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.

2 participants