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: Sending 2 requests instead of 1 to create a Guild role. #1557

Merged
merged 1 commit into from
Jun 15, 2020
Merged

Fix: Sending 2 requests instead of 1 to create a Guild role. #1557

merged 1 commit into from
Jun 15, 2020

Conversation

BrammyS
Copy link
Contributor

@BrammyS BrammyS commented Jun 2, 2020

Summary


The GuildHelper.CreateRoleAsync() was sending 2 requests to create a role. One to create the role, and one to modify the role after it was created.
This can be done in one request. So i have moved it to a single request to lower the amount of requests send to the api.
This will also solve issue #1451 where it it was successfully creating a role, but getting stuck on the modify request.

Changes


  • Added API.Rest.CreateGuildRoleParams.
  • Changed the API request in the DiscordRestApiClient to SendJsonAsync with the the API.Rest.CreateGuildRoleParams.
  • Removed role.ModifyAsync() from GuildHelper.CreateRoleAsync().

Refrences


https://discord.com/developers/docs/resources/guild#create-guild-role

The GuildHelper.CreateRoleAsync() was sending 2 requests to create a role. One to create the role, and one to modify the role that was created. This can be done in one request. So i have moved it to a single request to lower the amount of requests send to the api. This will also solve issue #1451.
Copy link

@AraHaan AraHaan left a comment

Choose a reason for hiding this comment

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

LGTM

@foxbot foxbot merged commit 5430cc8 into discord-net:dev Jun 15, 2020
anonymousheadless pushed a commit to anonymousheadless/Discord.Net that referenced this pull request Mar 29, 2021
…-net#1557)

The GuildHelper.CreateRoleAsync() was sending 2 requests to create a role. One to create the role, and one to modify the role that was created. This can be done in one request. So i have moved it to a single request to lower the amount of requests send to the api. This will also solve issue discord-net#1451.
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