-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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 user_guild_settings support #1365
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
you could replace these waterfalls with try/catch get muted() {
if (this.client.user.bot) return null;
if (!this.client.user.guildSettings) return null;
if (!this.client.user.guildSettings.get(this.guild.id)) return null;
if (!this.client.user.guildSettings.get(this.guild.id).channelOverrides) return false;
if (!this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id)) return false;
return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted;
} to get messageNotifications() {
try {
return this.client.user.guildSettings.get(this.guild.id).channelOverrides.get(this.id).muted;
} catch (err) {
return false;
}
} |
This needs a rebase. |
As requested by @GusCaplan, switched waterfalls to try/catches Also did some |
amishshah
force-pushed
the
master
branch
4 times, most recently
from
April 29, 2017 18:45
260b09e
to
5b2ca32
Compare
@Ratismal this needs a rebase |
@Ratismal is this ready to merge |
devsnek
reviewed
Jul 28, 2017
src/structures/Guild.js
Outdated
if (this.client.user.bot) return null; | ||
if (!this.client.user.guildSettings) return null; | ||
if (!this.client.user.guildSettings.get(this.id)) return null; | ||
return this.client.user.guildSettings.get(this.id).suppressEveryone; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try/catch
This was referenced Jan 17, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the ready event, discord sends two properties specific to ClientUsers - UserSettings and UserGuildSettings. UserSettings has already been wrapped, so this PR aims to wrap UserGuildSettings.
This is accomplished by create two new structures: ClientUserGuildSettings and ClientUserChannelOverrides. These contain wrappings for the user guild settings, and the former contains a Collection of the latter.
Additionally, the Guild and GuildChannel classes both have new properties obtained from these wraps.
I didn't implement the actions required to modify these settings, and will look into doing that in the future (I didn't implement because I wasn't sure how to do it).
I also didn't know the best way to accomplish this, so feel free to give feedback or suggestions on reimplementation.
Thank you for your time.