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 support for guild time outs. #161

Merged
merged 31 commits into from
Dec 20, 2021

Conversation

Victorsitou
Copy link
Member

@Victorsitou Victorsitou commented Nov 22, 2021

Summary

Discord has been experimenting with guild time outs lately, so I decided to try to implement it.

A few hours ago they added a new permission to add timeouts, so I guess this will actually be implemented.

TODO:

  • Add audit log.
  • Guild.timeout(...)?

new permission reference:
Discord-Datamining/Discord-Datamining@35cb2c6

Checklist

  • If code changes were made then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running black .
  • 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, ...)

@Victorsitou Victorsitou marked this pull request as draft November 22, 2021 21:16
@shiftinv shiftinv added t: api support Support of Discord API features t: enhancement New feature s: in progress Issue/PR is being worked on labels Nov 22, 2021
@shiftinv shiftinv linked an issue Nov 22, 2021 that may be closed by this pull request
@Victorsitou Victorsitou changed the title Add support for guild timeouts. Add support for guild time outs. Nov 22, 2021
Copy link
Member

@shiftinv shiftinv left a comment

Choose a reason for hiding this comment

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

Nice!
Made some initial comments, mostly documentation-related.

Member._update also needs to handle the new value, to keep the member cache consistent with the current state.

One change I'd like to propose is to change the (relatively long) name of communication_disabled_until to something like guild_timeout or just timeout, similar to the abstraction of rate_limit_per_user behind slowmode_delay; perhaps others can pitch in regarding this idea.

disnake/permissions.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
disnake/permissions.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
@Victorsitou
Copy link
Member Author

Victorsitou commented Nov 22, 2021

Member._update also needs to handle the new value, to keep the member cache consistent with the current state.

Done. 27a0241

One change I'd like to propose is to change the (relatively long) name of communication_disabled_until to something like guild_timeout or just timeout, similar to the abstraction of rate_limit_per_user behind slowmode_delay; perhaps others can pitch in regarding this idea.

Hmm, sounds good to me, I would go with timeout, but I would like to hear other suggestions.

Also, regarding the name, I created a poll in the Discord server. So I'm going to wait until it gets some votes.

@Victorsitou Victorsitou requested a review from shiftinv November 23, 2021 16:21
@Victorsitou
Copy link
Member Author

Victorsitou commented Nov 23, 2021

timeout function is not fully done, I forgot to add some things.

Update: it should be ready for review right now.

@Victorsitou
Copy link
Member Author

It seems that Discord finally added the audit log key.

image

@Victorsitou
Copy link
Member Author

Okay so, the PR should be ready for review, but I think it's worth to wait until it's released, basically to avoid possibly breaking changes.

Copy link
Member

@shiftinv shiftinv left a comment

Choose a reason for hiding this comment

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

Looks good! Just have a few more suggestions.
And yea, this shouldn't be merged before the feature is rolled out to more servers/users.

disnake/member.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
disnake/guild.py Outdated Show resolved Hide resolved
disnake/guild.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
disnake/guild.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
Co-authored-by: shiftinv <[email protected]>
Copy link
Collaborator

@thesadru thesadru left a comment

Choose a reason for hiding this comment

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

There's a lot of weird formatting going on due to the stupidly long variable name but we probs won't be able to do much about that.

disnake/guild.py Outdated Show resolved Hide resolved
disnake/audit_logs.py Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
disnake/member.py Outdated Show resolved Hide resolved
@Victorsitou Victorsitou marked this pull request as ready for review December 15, 2021 23:08
@Victorsitou Victorsitou marked this pull request as draft December 16, 2021 01:11
@Victorsitou Victorsitou marked this pull request as ready for review December 20, 2021 16:26
@shiftinv shiftinv merged commit 231fa71 into DisnakeDev:master Dec 20, 2021
@onerandomusername onerandomusername removed the s: in progress Issue/PR is being worked on label Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t: api support Support of Discord API features t: enhancement New feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for Guild time outs.
4 participants