Package Exports
- avdiscordutils
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (avdiscordutils) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
avdiscordutils
Provides FindOrCreate options for discord roles and channels and is open for future development and functions to be added
Installation
Use the package manager npm to install avdiscordutils.
npm install avdiscordutils --save
Usage
const DiscordUtils = require('avdiscordutils')
//findOrCreate channel
DiscordUtils(message.guild).findOrCreateChannel('exampleChannel' , {type : 'category'})
.then(channel => console.log(`Channel ${channel.name} has been created`))
.catch(console.error)
//findOrCreate role
DiscordUtils(message.guild).findOrCreateRole('exampleRole')
.then(role => console.log(`Role ${role.name} has been created`))
.catch(console.error)
As shown above by the usage of .then calls, avdiscordutils uses Promises extensively. This means that, if your Node version supports it, you can use ES2017 async/await syntax for all asynchronous calls made with avdiscordutils.
Documentation function
//findOrCreate channel
findOrCreateChannel(required string name , optional object options)
//findOrCreate role
findOrCreateRole(required string name , optional object options)
options object can be found on the official discord documentation.
findOrCreateChannel options object
findOrCreateRole options object
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.