mirror of
https://github.com/danbulant/discord.js
synced 2026-05-26 13:32:04 +00:00
Replace console.log in catches with console.error
This commit is contained in:
parent
8d18ed42f6
commit
b6c26cc2ae
9 changed files with 39 additions and 39 deletions
File diff suppressed because one or more lines are too long
|
|
@ -230,7 +230,7 @@ class VoiceConnection extends EventEmitter {
|
|||
* .then(connection => {
|
||||
* const dispatcher = connection.playFile('C:/Users/Discord/Desktop/music.mp3');
|
||||
* })
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
playFile(file, { seek = 0, volume = 1, passes = 1 } = {}) {
|
||||
const options = { seek, volume, passes };
|
||||
|
|
@ -251,7 +251,7 @@ class VoiceConnection extends EventEmitter {
|
|||
* const stream = ytdl('https://www.youtube.com/watch?v=XAWgeLF9EVQ', {filter : 'audioonly'});
|
||||
* const dispatcher = connection.playStream(stream, streamOptions);
|
||||
* })
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
playStream(stream, { seek = 0, volume = 1, passes = 1 } = {}) {
|
||||
const options = { seek, volume, passes };
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ class Channel {
|
|||
* // delete the channel
|
||||
* channel.delete()
|
||||
* .then() // success
|
||||
* .catch(console.log); // log error
|
||||
* .catch(console.error); // log error
|
||||
*/
|
||||
delete() {
|
||||
return this.client.rest.methods.deleteChannel(this);
|
||||
|
|
|
|||
|
|
@ -340,7 +340,7 @@ class Guild {
|
|||
* region: 'london',
|
||||
* })
|
||||
* .then(updated => console.log(`New guild name ${updated.name} in region ${updated.region}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(data) {
|
||||
return this.client.rest.methods.updateGuild(this, data);
|
||||
|
|
@ -354,7 +354,7 @@ class Guild {
|
|||
* // edit the guild name
|
||||
* guild.setName('Discord Guild')
|
||||
* .then(updated => console.log(`Updated guild name to ${guild.name}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setName(name) {
|
||||
return this.edit({ name });
|
||||
|
|
@ -368,7 +368,7 @@ class Guild {
|
|||
* // edit the guild region
|
||||
* guild.setRegion('london')
|
||||
* .then(updated => console.log(`Updated guild region to ${guild.region}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setRegion(region) {
|
||||
return this.edit({ region });
|
||||
|
|
@ -382,7 +382,7 @@ class Guild {
|
|||
* // edit the guild verification level
|
||||
* guild.setVerificationLevel(1)
|
||||
* .then(updated => console.log(`Updated guild verification level to ${guild.verificationLevel}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setVerificationLevel(verificationLevel) {
|
||||
return this.edit({ verificationLevel });
|
||||
|
|
@ -396,7 +396,7 @@ class Guild {
|
|||
* // edit the guild AFK channel
|
||||
* guild.setAFKChannel(channel)
|
||||
* .then(updated => console.log(`Updated guild AFK channel to ${guild.afkChannel}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setAFKChannel(afkChannel) {
|
||||
return this.edit({ afkChannel });
|
||||
|
|
@ -410,7 +410,7 @@ class Guild {
|
|||
* // edit the guild AFK channel
|
||||
* guild.setAFKTimeout(60)
|
||||
* .then(updated => console.log(`Updated guild AFK timeout to ${guild.afkTimeout}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setAFKTimeout(afkTimeout) {
|
||||
return this.edit({ afkTimeout });
|
||||
|
|
@ -424,7 +424,7 @@ class Guild {
|
|||
* // edit the guild icon
|
||||
* guild.setIcon(fs.readFileSync('./icon.png'))
|
||||
* .then(updated => console.log('Updated the guild icon'))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setIcon(icon) {
|
||||
return this.edit({ icon });
|
||||
|
|
@ -438,7 +438,7 @@ class Guild {
|
|||
* // edit the guild owner
|
||||
* guild.setOwner(guilds.members[0])
|
||||
* .then(updated => console.log(`Updated the guild owner to ${updated.owner.username}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setOwner(owner) {
|
||||
return this.edit({ owner });
|
||||
|
|
@ -452,7 +452,7 @@ class Guild {
|
|||
* // edit the guild splash
|
||||
* guild.setIcon(fs.readFileSync('./splash.png'))
|
||||
* .then(updated => console.log('Updated the guild splash'))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setSplash(splash) {
|
||||
return this.edit({ splash });
|
||||
|
|
@ -525,7 +525,7 @@ class Guild {
|
|||
* // create a new text channel
|
||||
* guild.createChannel('new-general', 'text')
|
||||
* .then(channel => console.log(`Created new channel ${channel}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
createChannel(name, type) {
|
||||
return this.client.rest.methods.createChannel(this, name, type);
|
||||
|
|
@ -539,12 +539,12 @@ class Guild {
|
|||
* // create a new role
|
||||
* guild.createRole()
|
||||
* .then(role => console.log(`Created role ${role}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // create a new role with data
|
||||
* guild.createRole({ name: 'Super Cool People' })
|
||||
* .then(role => console.log(`Created role ${role}`))
|
||||
* .catch(console.log)
|
||||
* .catch(console.error)
|
||||
*/
|
||||
createRole(data) {
|
||||
const create = this.client.rest.methods.createGuildRole(this);
|
||||
|
|
@ -561,12 +561,12 @@ class Guild {
|
|||
* // create a new emoji from a url
|
||||
* guild.createEmoji('https://i.imgur.com/w3duR07.png', 'rip')
|
||||
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
* @example
|
||||
* // create a new emoji from a file on your computer
|
||||
* guild.createEmoji('./memes/banana.png', 'banana')
|
||||
* .then(emoji => console.log(`Created new emoji with name ${emoji.name}!`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
createEmoji(attachment, name) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
@ -596,7 +596,7 @@ class Guild {
|
|||
* // leave a guild
|
||||
* guild.leave()
|
||||
* .then(g => console.log(`Left the guild ${g}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
leave() {
|
||||
return this.client.rest.methods.leaveGuild(this);
|
||||
|
|
@ -609,7 +609,7 @@ class Guild {
|
|||
* // delete a guild
|
||||
* guild.delete()
|
||||
* .then(g => console.log(`Deleted the guild ${g}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
delete() {
|
||||
return this.client.rest.methods.deleteGuild(this);
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ class GuildChannel extends Channel {
|
|||
* SEND_MESSAGES: false
|
||||
* })
|
||||
* .then(() => console.log('Done!'))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
overwritePermissions(userOrRole, options) {
|
||||
const payload = {
|
||||
|
|
@ -170,7 +170,7 @@ class GuildChannel extends Channel {
|
|||
* // set a new channel name
|
||||
* channel.setName('not_general')
|
||||
* .then(newChannel => console.log(`Channel's new name is ${newChannel.name}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setName(name) {
|
||||
return this.client.rest.methods.updateChannel(this, { name });
|
||||
|
|
@ -184,7 +184,7 @@ class GuildChannel extends Channel {
|
|||
* // set a new channel position
|
||||
* channel.setPosition(2)
|
||||
* .then(newChannel => console.log(`Channel's new position is ${newChannel.position}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setPosition(position) {
|
||||
return this.client.rest.methods.updateChannel(this, { position });
|
||||
|
|
@ -198,7 +198,7 @@ class GuildChannel extends Channel {
|
|||
* // set a new channel topic
|
||||
* channel.setTopic('needs more rate limiting')
|
||||
* .then(newChannel => console.log(`Channel's new topic is ${newChannel.topic}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setTopic(topic) {
|
||||
return this.client.rest.methods.updateChannel(this, { topic });
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ class Message {
|
|||
* // update the content of a message
|
||||
* message.edit('This is my new content!')
|
||||
* .then(msg => console.log(`Updated the content of a message from ${msg.author}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(content) {
|
||||
return this.client.rest.methods.updateMessage(this, content);
|
||||
|
|
@ -342,7 +342,7 @@ class Message {
|
|||
* // delete a message
|
||||
* message.delete()
|
||||
* .then(msg => console.log(`Deleted message from ${msg.author}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
delete(timeout = 0) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
@ -363,7 +363,7 @@ class Message {
|
|||
* // reply to a message
|
||||
* message.reply('Hey, I'm a reply!')
|
||||
* .then(msg => console.log(`Sent a reply to ${msg.author}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
reply(content, options = {}) {
|
||||
content = this.client.resolver.resolveString(content);
|
||||
|
|
|
|||
|
|
@ -151,7 +151,7 @@ class Role {
|
|||
* // edit a role
|
||||
* role.edit({name: 'new role'})
|
||||
* .then(r => console.log(`Edited role ${r}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
edit(data) {
|
||||
return this.client.rest.methods.updateGuildRole(this, data);
|
||||
|
|
@ -165,7 +165,7 @@ class Role {
|
|||
* // set the name of the role
|
||||
* role.setName('new role')
|
||||
* .then(r => console.log(`Edited name of role ${r}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setName(name) {
|
||||
return this.client.rest.methods.updateGuildRole(this, { name });
|
||||
|
|
@ -179,7 +179,7 @@ class Role {
|
|||
* // set the color of a role
|
||||
* role.setColor('#FF0000')
|
||||
* .then(r => console.log(`Set color of role ${r}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setColor(color) {
|
||||
return this.client.rest.methods.updateGuildRole(this, { color });
|
||||
|
|
@ -193,7 +193,7 @@ class Role {
|
|||
* // set the hoist of the role
|
||||
* role.setHoist(true)
|
||||
* .then(r => console.log(`Role hoisted: ${r.hoist}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setHoist(hoist) {
|
||||
return this.client.rest.methods.updateGuildRole(this, { hoist });
|
||||
|
|
@ -207,7 +207,7 @@ class Role {
|
|||
* // set the position of the role
|
||||
* role.setPosition(1)
|
||||
* .then(r => console.log(`Role position: ${r.position}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setPosition(position) {
|
||||
return this.client.rest.methods.updateGuildRole(this, { position });
|
||||
|
|
@ -221,7 +221,7 @@ class Role {
|
|||
* // set the permissions of the role
|
||||
* role.setPermissions(['KICK_MEMBERS', 'BAN_MEMBERS'])
|
||||
* .then(r => console.log(`Role updated ${r}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setPermissions(permissions) {
|
||||
return this.client.rest.methods.updateGuildRole(this, { permissions });
|
||||
|
|
@ -234,7 +234,7 @@ class Role {
|
|||
* // delete a role
|
||||
* role.delete()
|
||||
* .then(r => console.log(`Deleted role ${r}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
delete() {
|
||||
return this.client.rest.methods.deleteGuildRole(this);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ class VoiceChannel extends GuildChannel {
|
|||
* // set the bitrate of a voice channel
|
||||
* voiceChannel.setBitrate(48000)
|
||||
* .then(vc => console.log(`Set bitrate to ${vc.bitrate} for ${vc.name}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
setBitrate(bitrate) {
|
||||
return this.rest.client.rest.methods.updateChannel(this, { bitrate });
|
||||
|
|
@ -66,7 +66,7 @@ class VoiceChannel extends GuildChannel {
|
|||
* // join a voice channel
|
||||
* voiceChannel.join()
|
||||
* .then(connection => console.log('Connected!'))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
join() {
|
||||
return this.client.voice.joinChannel(this);
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class TextBasedChannel {
|
|||
* // send a message
|
||||
* channel.sendMessage('hello!')
|
||||
* .then(message => console.log(`Sent message: ${message.content}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
sendMessage(content, options = {}) {
|
||||
return this.client.rest.methods.sendMessage(this, content, options);
|
||||
|
|
@ -66,7 +66,7 @@ class TextBasedChannel {
|
|||
* // send a TTS message
|
||||
* channel.sendTTSMessage('hello!')
|
||||
* .then(message => console.log(`Sent tts message: ${message.content}`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
sendTTSMessage(content, options = {}) {
|
||||
Object.assign(options, { tts: true });
|
||||
|
|
@ -158,7 +158,7 @@ class TextBasedChannel {
|
|||
* // get messages
|
||||
* channel.fetchMessages({limit: 10})
|
||||
* .then(messages => console.log(`Received ${messages.size} messages`))
|
||||
* .catch(console.log);
|
||||
* .catch(console.error);
|
||||
*/
|
||||
fetchMessages(options = {}) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue