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

Implement 'Modify Guild Channel Positions' #1198

Merged
merged 7 commits into from Feb 22, 2017
Merged

Implement 'Modify Guild Channel Positions' #1198

merged 7 commits into from Feb 22, 2017

Conversation

ghost
Copy link

@ghost ghost commented Feb 19, 2017

Currently the library implements the 'Create Channels' endpoint via POST to /guilds/{guild.id}/channels, but doesn't implement the 'Modify Guild Channel Positions' endpoint at all.

This change adds that support as well as a method on Guild which will shuffle all existing channels using a new utility method for shuffling arrays.

@iCrawl
Copy link
Member

iCrawl commented Feb 19, 2017

memes 👍
shuffle

@aemino
Copy link
Contributor

aemino commented Feb 19, 2017

This is a great PR but you mixed it with a meme... please separate the meme and the real PR thank you. 🙇

@ghost ghost changed the title Implement 'Modify Guild Channel Positions' and use in 'shuffleChannels' method on Guild Implement 'Modify Guild Channel Positions' Feb 19, 2017
@ghost
Copy link
Author

ghost commented Feb 19, 2017

Removed shuffleChannels method from the Guild object and replaced with a regular 'updateChannels' method. Also removed the shuffleArray utility method since it would be unused.

@devsnek
Copy link
Member

devsnek commented Feb 19, 2017

shouldn't the method be named updateChannelPositions since that is all it changes

@devsnek
Copy link
Member

devsnek commented Feb 19, 2017

also channelId => channelID to keep with our standards

@ghost
Copy link
Author

ghost commented Feb 19, 2017

I'll make those changes asap when I get home, thank you!

@ghost
Copy link
Author

ghost commented Feb 20, 2017

Updated 'channelId' to 'channelID', I was also using 'guildId' instead of 'guildID' in RESTMethods so I updated that as well.


/**
* Updates this guild's channel positions as a batch.
* @param {Object[]} newChannelPositions Array of objects with an id and a position.
Copy link
Member

Choose a reason for hiding this comment

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

A typedef is needed, rather than Object.

@ghost
Copy link
Author

ghost commented Feb 21, 2017

Should I do two typedefs, one for the array and one for the object inside?

@Gawdl3y
Copy link
Member

Gawdl3y commented Feb 21, 2017

No, just one for the object.

@ghost
Copy link
Author

ghost commented Feb 21, 2017

I updated the doc, please let me know if it needs more changes -- haven't worked with this style of documentation before. Thanks!

@amishshah
Copy link
Member

Looks good! 👍

@amishshah amishshah merged commit f068010 into discordjs:master Feb 22, 2017
devsnek pushed a commit to devsnek/discord.js that referenced this pull request May 14, 2017
* Adding shuffleArray method to utils

* Shuffle channels functionality on guild.

* Comment fix

* Removing shuffle functionality and replacing with a simple update

* Code review changes to method/variable names

* Update comment reference to channelId as well

* Updating jsdoc with typedef of ChannelPosition
devsnek pushed a commit to devsnek/discord.js that referenced this pull request May 14, 2017
* Adding shuffleArray method to utils

* Shuffle channels functionality on guild.

* Comment fix

* Removing shuffle functionality and replacing with a simple update

* Code review changes to method/variable names

* Update comment reference to channelId as well

* Updating jsdoc with typedef of ChannelPosition
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.

None yet

7 participants