瀏覽代碼

trying to catch the error

Markus-Rost 6 年之前
父節點
當前提交
591cbd2452
共有 1 個文件被更改,包括 10 次插入2 次删除
  1. 10 2
      main.js

+ 10 - 2
main.js

@@ -1395,7 +1395,11 @@ Discord.MessageReaction.prototype.removeEmoji = function() {
 
 
 Discord.Message.prototype.sendChannel = function(content, options, ignorePause = false) {
 Discord.Message.prototype.sendChannel = function(content, options, ignorePause = false) {
 	if ( this.channel.type !== 'text' || !pause[this.guild.id] || ( ignorePause && ( this.isAdmin() || this.isOwner() ) ) ) {
 	if ( this.channel.type !== 'text' || !pause[this.guild.id] || ( ignorePause && ( this.isAdmin() || this.isOwner() ) ) ) {
-		return this.channel.send(content, options).catch(log_error);
+		return this.channel.send(content, options).then(msg => {
+			if ( !( msg instanceof Discord.Message ) ) {
+				log_error({name:'Message is not a message',message:'\n\u200b' + util.inspect( msg ).replace( /\n/g, '\n\u200b' )}, true, 'Sending');
+			} else return msg;
+		}, log_error);
 	} else {
 	} else {
 		console.log( '- Abgebrochen, pausiert.' );
 		console.log( '- Abgebrochen, pausiert.' );
 		return Promise.resolve();
 		return Promise.resolve();
@@ -1408,7 +1412,11 @@ Discord.Message.prototype.sendChannelError = function(content, options) {
 
 
 Discord.Message.prototype.replyMsg = function(content, options, ignorePause = false) {
 Discord.Message.prototype.replyMsg = function(content, options, ignorePause = false) {
 	if ( this.channel.type !== 'text' || !pause[this.guild.id] || ( ignorePause && ( this.isAdmin() || this.isOwner() ) ) ) {
 	if ( this.channel.type !== 'text' || !pause[this.guild.id] || ( ignorePause && ( this.isAdmin() || this.isOwner() ) ) ) {
-		return this.reply(content, options).catch(log_error);
+		return this.reply(content, options).then(msg => {
+			if ( !( msg instanceof Discord.Message ) ) {
+				log_error({name:'Message is not a message',message:'\n\u200b' + util.inspect( msg ).replace( /\n/g, '\n\u200b' )}, true, 'Sending');
+			} else return msg;
+		}, log_error);;
 	} else {
 	} else {
 		console.log( '- Abgebrochen, pausiert.' );
 		console.log( '- Abgebrochen, pausiert.' );
 		return Promise.resolve();
 		return Promise.resolve();