-
-
Notifications
You must be signed in to change notification settings - Fork 740
[Feature] New ModifyCurrentApplication features
#2730
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
Merged
Misha-133
merged 5 commits into
discord-net:dev
from
Misha-133:feature/udapte-modify-current-application
Aug 10, 2023
Merged
[Feature] New ModifyCurrentApplication features
#2730
Misha-133
merged 5 commits into
discord-net:dev
from
Misha-133:feature/udapte-modify-current-application
Aug 10, 2023
Conversation
This file contains hidden or 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
Panthr75
suggested changes
Jul 14, 2023
Panthr75
suggested changes
Jul 15, 2023
Contributor
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.
What about adding a builder type for building the scopes that you can pass into ApplicationInstallParams so that you can get the benefit of knowing the scopes you can use and the option of specifying new scopes that they release indirectly?
Example mock class:
class ApplicationScopesBuilder
{
private readonly List<string> _scopes = new();
public bool ReadActivities
{
get => HasScope("activities.read");
set => SetScope("activities.read", value);
}
public bool WriteActivities
{
get => HasScope("activities.write");
set => SetScope("activities.write", value);
}
public bool ReadApplicationBuilds
{
get => HasScope("applications.builds.read");
set => SetScope("applications.builds.read", value);
}
public bool UploadApplicationBuilds
{
get => HasScope("applications.builds.upload");
set => SetScope("applications.builds.upload", value);
}
public bool ApplicationCommands
{
get => HasScope("applications.commands");
set => SetScope("applications.commands", value);
}
public bool UpdateApplicationCommands
{
get => HasScope("applications.commands.update");
set => SetScope("applications.commands.update", value);
}
public bool UpdateApplicationCommandPermissions
{
get => HasScope("applications.commands.permissions.update");
set => SetScope("applications.commands.permissions.update", value);
}
public bool ApplicationEntitlements
{
get => HasScope("applications.entitlements");
set => SetScope("applications.entitlements", value);
}
public bool UpdateApplicationStore
{
get => HasScope("applications.store.update");
set => SetScope("applications.store.update", value);
}
public bool Bot
{
get => HasScope("bot");
set => SetScope("bot", value);
}
public bool Connections
{
get => HasScope("connections");
set => SetScope("connections", value);
}
public bool ReadDmChannels
{
get => HasScope("dm_channels.read");
set => SetScope("dm_channels.read", value);
}
public bool Email
{
get => HasScope("email");
set => SetScope("email", value);
}
public bool JoinGdm
{
get => HasScope("gdm.join");
set => SetScope("gdm.join", value);
}
public bool Guilds
{
get => HasScope("guilds");
set => SetScope("guilds", value);
}
public bool JoinGuilds
{
get => HasScope("guilds.join");
set => SetScope("guilds.join", value);
}
public bool ReadGuildsMembers
{
get => HasScope("guilds.members.read");
set => SetScope("guilds.members.read", value);
}
public bool Identify
{
get => HasScope("identify");
set => SetScope("identify", value);
}
public bool ReadMessages
{
get => HasScope("messages.read");
set => SetScope("messages.read", value);
}
public bool ReadRelationships
{
get => HasScope("relationships.read");
set => SetScope("relationships.read", value);
}
public bool WriteRoleConnections
{
get => HasScope("role_connections.write");
set => SetScope("role_connections.write", value);
}
public bool Rpc
{
get => HasScope("rpc");
set => SetScope("rpc", value);
}
public bool RpcWriteActivities
{
get => HasScope("rpc.activities.write");
set => SetScope("rpc.activities.write", value);
}
public bool RpcReadNotifications
{
get => HasScope("rpc.notifications.read");
set => SetScope("rpc.notifications.read", value);
}
public bool RpcReadVoice
{
get => HasScope("rpc.voice.read");
set => SetScope("rpc.voice.read", value);
}
public bool RpcWriteVoice
{
get => HasScope("rpc.voice.write");
set => SetScope("rpc.voice.write", value);
}
public bool Voice
{
get => HasScope("voice");
set => SetScope("voice", value);
}
public bool IncomingWebhook
{
get => HasScope("webhook.incoming");
set => SetScope("webhook.incoming", value);
}
public void SetScope(string scopeName, bool value)
{
if (value) AddScope(scopeName);
else RemoveScope(scopeName);
}
public void RemoveScope(string scopeName)
{
if (scopeName is null) return;
_scopes.Remove(scopeName.ToLower());
}
public void AddScope(string scopeName)
{
if (scopeName is null) return;
scopeName = scopeName.ToLower();
if (!_scopes.Contains(scopeName)) _scopes.Add(scopeName);
}
public bool HasScope(string scopeName)
{
return scopeName is null ? false : _scopes.Contains(scopeName);
}
}
quinchs
approved these changes
Aug 10, 2023
Co-authored-by: Quin Lynch <[email protected]>
…ithub.com/Misha-133/Discord.Net into feature/udapte-modify-current-application
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.
Docs PR
This PR adds some newly documented features for
Edit Current Applicationendpoint.Changes
ApplicationInstallParamspublic, so it can be used to modify the appApplicationInstallParams.Permissionis not nullable