浏览代码

fix empty string error

Markus-Rost 3 年之前
父节点
当前提交
c5e2800198
共有 3 个文件被更改,包括 10 次插入10 次删除
  1. 4 4
      cmds/get.js
  2. 3 3
      cmds/rcscript.js
  3. 3 3
      cmds/verification.js

+ 4 - 4
cmds/get.js

@@ -127,13 +127,13 @@ async function cmd_get(lang, msg, args, line, wiki) {
 			}, dberror => {
 			}, dberror => {
 				console.log( '- Error while getting the settings: ' + dberror );
 				console.log( '- Error while getting the settings: ' + dberror );
 			} ).then( () => {
 			} ).then( () => {
-				var text = '';
+				var text = null;
 				var embed = null;
 				var embed = null;
 				if ( msg.showEmbed() ) {
 				if ( msg.showEmbed() ) {
 					embed = new MessageEmbed().addField( channelguild[0], channelguild[1] ).addField( channelname[0], channelname[1] ).addField( channeldetails[0], channeldetails[1] ).addField( channelpermissions[0], channelpermissions[1] ).addField( channellang[0], channellang[1] ).addField( channelwiki[0], channelwiki[1] ).addField( channelrole[0], channelrole[1] ).addField( channelinline[0], channelinline[1] );
 					embed = new MessageEmbed().addField( channelguild[0], channelguild[1] ).addField( channelname[0], channelname[1] ).addField( channeldetails[0], channeldetails[1] ).addField( channelpermissions[0], channelpermissions[1] ).addField( channellang[0], channellang[1] ).addField( channelwiki[0], channelwiki[1] ).addField( channelrole[0], channelrole[1] ).addField( channelinline[0], channelinline[1] );
 				}
 				}
 				else {
 				else {
-					text += channelguild.join(' ') + '\n' + channelname.join(' ') + '\n' + channeldetails.join(' ') + '\n' + channelpermissions.join(' ') + '\n' + channellang.join(' ') + '\n' + channelwiki[0] + ' <' + channelwiki[1] + '>\n' + channelrole.join(' ') + '\n' + channelinline.join(' ');
+					text = channelguild.join(' ') + '\n' + channelname.join(' ') + '\n' + channeldetails.join(' ') + '\n' + channelpermissions.join(' ') + '\n' + channellang.join(' ') + '\n' + channelwiki[0] + ' <' + channelwiki[1] + '>\n' + channelrole.join(' ') + '\n' + channelinline.join(' ');
 				}
 				}
 				msg.sendChannel( {content: text, embeds: [embed]}, true );
 				msg.sendChannel( {content: text, embeds: [embed]}, true );
 			} );
 			} );
@@ -160,10 +160,10 @@ async function cmd_get(lang, msg, args, line, wiki) {
 			} );
 			} );
 			if ( guilds.length ) guildlist[1] = guilds.join('\n');
 			if ( guilds.length ) guildlist[1] = guilds.join('\n');
 			if ( guildlist[1].length > 1000 ) guildlist[1] = guilds.length;
 			if ( guildlist[1].length > 1000 ) guildlist[1] = guilds.length;
-			var text = '';
+			var text = null;
 			var embed = null;
 			var embed = null;
 			if ( msg.showEmbed() ) embed = new MessageEmbed().setThumbnail( user.displayAvatarURL({dynamic:true}) ).addField( username[0], username[1] ).addField( guildlist[0], guildlist[1] );
 			if ( msg.showEmbed() ) embed = new MessageEmbed().setThumbnail( user.displayAvatarURL({dynamic:true}) ).addField( username[0], username[1] ).addField( guildlist[0], guildlist[1] );
-			else text += username.join(' ') + '\n' + guildlist.join('\n');
+			else text = username.join(' ') + '\n' + guildlist.join('\n');
 			return msg.sendChannel( {content: text, embeds: [embed]}, true );
 			return msg.sendChannel( {content: text, embeds: [embed]}, true );
 		}
 		}
 		
 		

+ 3 - 3
cmds/rcscript.js

@@ -505,9 +505,9 @@ function cmd_rcscript(lang, msg, args, line, wiki) {
 			} );
 			} );
 			rows = rows.filter( row => row.channel );
 			rows = rows.filter( row => row.channel );
 			var only = ( rows.length === 1 );
 			var only = ( rows.length === 1 );
-			var text = '';
+			var text = null;
 			if ( rows.length ) {
 			if ( rows.length ) {
-				text += lang.get('rcscript.current');
+				text = lang.get('rcscript.current');
 				if ( button ) text += `\n<${button.url}>`;
 				if ( button ) text += `\n<${button.url}>`;
 				text += rows.map( row => {
 				text += rows.map( row => {
 					var cmd = prefix + 'rcscript' + ( only ? '' : ' ' + row.configid );
 					var cmd = prefix + 'rcscript' + ( only ? '' : ' ' + row.configid );
@@ -534,7 +534,7 @@ function cmd_rcscript(lang, msg, args, line, wiki) {
 				} ).join('');
 				} ).join('');
 			}
 			}
 			else {
 			else {
-				text += lang.get('rcscript.missing');
+				text = lang.get('rcscript.missing');
 				if ( button ) text += `\n<${button.url}>`;
 				if ( button ) text += `\n<${button.url}>`;
 			}
 			}
 			if ( rows.length < limit ) text += '\n\n' + lang.get('rcscript.add_more') + '\n`' + prefix + 'rcscript add ' + lang.get('rcscript.new_wiki') + '`';
 			if ( rows.length < limit ) text += '\n\n' + lang.get('rcscript.add_more') + '\n`' + prefix + 'rcscript add ' + lang.get('rcscript.new_wiki') + '`';

+ 3 - 3
cmds/verification.js

@@ -84,14 +84,14 @@ function cmd_verification(lang, msg, args, line, wiki) {
 				if ( !pause[msg.guildId] ) this.verify(lang, msg, args, line, wiki);
 				if ( !pause[msg.guildId] ) this.verify(lang, msg, args, line, wiki);
 				return;
 				return;
 			}
 			}
-			var text = '';
+			var text = null;
 			if ( rows.length ) {
 			if ( rows.length ) {
-				text += lang.get('verification.current');
+				text = lang.get('verification.current');
 				if ( button ) text += `\n<${button.url}>`;
 				if ( button ) text += `\n<${button.url}>`;
 				text += rows.map( row => formatVerification(false, true, row) ).join('');
 				text += rows.map( row => formatVerification(false, true, row) ).join('');
 			}
 			}
 			else {
 			else {
-				text += lang.get('verification.missing');
+				text = lang.get('verification.missing');
 				if ( button ) text += `\n<${button.url}>`;
 				if ( button ) text += `\n<${button.url}>`;
 			}
 			}
 			text += '\n\n' + lang.get('verification.add_more') + '\n`' + prefix + 'verification add ' + lang.get('verification.new_role') + '`';
 			text += '\n\n' + lang.get('verification.add_more') + '\n`' + prefix + 'verification add ' + lang.get('verification.new_role') + '`';