Quellcode durchsuchen

fix language code

Markus-Rost vor 4 Jahren
Ursprung
Commit
99c4421e4e
14 geänderte Dateien mit 17 neuen und 24 gelöschten Zeilen
  1. 3 1
      cmds/eval.js
  2. 1 1
      cmds/patreon.js
  3. 3 3
      cmds/settings.js
  4. 0 1
      i18n/de.json
  5. 0 1
      i18n/en.json
  6. 0 1
      i18n/fr.json
  7. 0 1
      i18n/nl.json
  8. 0 1
      i18n/pl.json
  9. 0 1
      i18n/pt.json
  10. 0 2
      i18n/ru.json
  11. 0 1
      i18n/tr.json
  12. 0 1
      i18n/zh.json
  13. 0 1
      util/default.json
  14. 10 8
      util/i18n.js

+ 3 - 1
cmds/eval.js

@@ -64,7 +64,9 @@ function updateAllSites() {
  */
  */
 function removePatreons(guild, msg) {
 function removePatreons(guild, msg) {
 	try {
 	try {
-		if ( !guild || !msg ) return 'removePatreons(guild, msg) – No guild or message provided!';
+		if ( !( typeof guild === 'string' || msg instanceof Discord.Message ) ) {
+			return 'removePatreons(guild, msg) – No guild or message provided!';
+		}
 		db.get( 'SELECT lang, inline FROM discord WHERE guild = ? AND channel IS NULL', [guild], (dberror, row) => {
 		db.get( 'SELECT lang, inline FROM discord WHERE guild = ? AND channel IS NULL', [guild], (dberror, row) => {
 			try {
 			try {
 				if ( dberror ) {
 				if ( dberror ) {

+ 1 - 1
cmds/patreon.js

@@ -178,7 +178,7 @@ function cmd_patreon(lang, msg, args, line, wiki) {
 			db.each( 'SELECT a.guild, GROUP_CONCAT(DISTINCT a.configid) configids FROM verification a LEFT JOIN verification b ON a.guild = b.guild WHERE a.guild IN (' + guilds.map( guild => '?' ).join(', ') + ') GROUP BY a.guild', guilds, (eacherror, eachrow) => {
 			db.each( 'SELECT a.guild, GROUP_CONCAT(DISTINCT a.configid) configids FROM verification a LEFT JOIN verification b ON a.guild = b.guild WHERE a.guild IN (' + guilds.map( guild => '?' ).join(', ') + ') GROUP BY a.guild', guilds, (eacherror, eachrow) => {
 				if ( eacherror ) {
 				if ( eacherror ) {
 					console.log( '- Error while getting the verifications: ' + eacherror );
 					console.log( '- Error while getting the verifications: ' + eacherror );
-					return dberror;
+					return eacherror;
 				}
 				}
 				var ids = eachrow.configids.split(',').slice(verificationLimit.default);
 				var ids = eachrow.configids.split(',').slice(verificationLimit.default);
 				if ( ids.length ) db.run( 'DELETE FROM verification WHERE guild = ? AND configid IN (' + ids.map( configid => '?' ).join(', ') + ')', [eachrow.guild, ...ids], function (uperror) {
 				if ( ids.length ) db.run( 'DELETE FROM verification WHERE guild = ? AND configid IN (' + ids.map( configid => '?' ).join(', ') + ')', [eachrow.guild, ...ids], function (uperror) {

+ 3 - 3
cmds/settings.js

@@ -204,7 +204,7 @@ function cmd_settings(lang, msg, args, line, wiki) {
 		}
 		}
 		
 		
 		if ( args[0] === 'lang' ) {
 		if ( args[0] === 'lang' ) {
-			if ( channel && !( msg.guild.id in patreons ) ) return msg.replyMsg( lang.get('patreon') + ' <' + process.env.patreon + '>', {}, true );
+			if ( channel && !( msg.guild.id in patreons ) ) return msg.replyMsg( lang.get('patreon') + '\n<' + process.env.patreon + '>', {}, true );
 			prelang += 'lang';
 			prelang += 'lang';
 			var langhelp = '\n' + lang.get('settings.langhelp', prefix + 'settings ' + prelang) + ' `' + Object.values(allLangs.names).map( val => val[0] ).join('`, `') + '`';
 			var langhelp = '\n' + lang.get('settings.langhelp', prefix + 'settings ' + prelang) + ' `' + Object.values(allLangs.names).map( val => val[0] ).join('`, `') + '`';
 			if ( !args[1] ) {
 			if ( !args[1] ) {
@@ -260,7 +260,7 @@ function cmd_settings(lang, msg, args, line, wiki) {
 		
 		
 		if ( args[0] === 'prefix' && !channel ) {
 		if ( args[0] === 'prefix' && !channel ) {
 			if ( !( msg.guild.id in patreons ) ) {
 			if ( !( msg.guild.id in patreons ) ) {
-				return msg.replyMsg( lang.get('patreon') + ' <' + process.env.patreon + '>', {}, true );
+				return msg.replyMsg( lang.get('patreon') + '\n<' + process.env.patreon + '>', {}, true );
 			}
 			}
 			var prefixhelp = '\n' + lang.get('settings.prefixhelp', prefix + 'settings prefix');
 			var prefixhelp = '\n' + lang.get('settings.prefixhelp', prefix + 'settings prefix');
 			args[1] = args[1].replace( /(?<!\\)_$/, ' ' ).replace( /\\([_\W])/g, '$1' );
 			args[1] = args[1].replace( /(?<!\\)_$/, ' ' ).replace( /\\([_\W])/g, '$1' );
@@ -290,7 +290,7 @@ function cmd_settings(lang, msg, args, line, wiki) {
 		}
 		}
 		
 		
 		if ( args[0] === 'inline' ) {
 		if ( args[0] === 'inline' ) {
-			if ( channel && !( msg.guild.id in patreons ) ) return msg.replyMsg( lang.get('patreon') + ' <' + process.env.patreon + '>', {}, true );
+			if ( channel && !( msg.guild.id in patreons ) ) return msg.replyMsg( lang.get('patreon') + '\n<' + process.env.patreon + '>', {}, true );
 			prelang += 'inline';
 			prelang += 'inline';
 			var toggle = 'inline ' + ( ( channel || guild ).inline ? 'disabled' : 'enabled' );
 			var toggle = 'inline ' + ( ( channel || guild ).inline ? 'disabled' : 'enabled' );
 			var inlinehelp = '\n' + lang.get('settings.' + toggle + '.help', prefix + 'settings ' + prelang + ' toggle', inlinepage);
 			var inlinehelp = '\n' + lang.get('settings.' + toggle + '.help', prefix + 'settings ' + prelang + ' toggle', inlinepage);

+ 0 - 1
i18n/de.json

@@ -201,7 +201,6 @@
 			"global-discussions-moderator": "Globaler Diskussions-Moderator",
 			"global-discussions-moderator": "Globaler Diskussions-Moderator",
 			"vanguard": "Portabilitäts-Pionier",
 			"vanguard": "Portabilitäts-Pionier",
 			"voldev": "Volunteer Developer",
 			"voldev": "Volunteer Developer",
-			"council": "Community Council",
 			"bot": "Bot",
 			"bot": "Bot",
 			"checkuser": "Checkuser-Berechtigter",
 			"checkuser": "Checkuser-Berechtigter",
 			"bureaucrat": "Bürokrat",
 			"bureaucrat": "Bürokrat",

+ 0 - 1
i18n/en.json

@@ -195,7 +195,6 @@
 			"global-discussions-moderator": "Global discussions moderator",
 			"global-discussions-moderator": "Global discussions moderator",
 			"vanguard": "Vanguard",
 			"vanguard": "Vanguard",
 			"voldev": "Volunteer Developer",
 			"voldev": "Volunteer Developer",
-			"council": "Community Council",
 			"bot": "Bot",
 			"bot": "Bot",
 			"checkuser": "Check user",
 			"checkuser": "Check user",
 			"bureaucrat": "Bureaucrat",
 			"bureaucrat": "Bureaucrat",

+ 0 - 1
i18n/fr.json

@@ -104,7 +104,6 @@
 			"global-discussions-moderator": "Modérateur global de discussions",
 			"global-discussions-moderator": "Modérateur global de discussions",
 			"vanguard": "Vanguard",
 			"vanguard": "Vanguard",
 			"voldev": "Développeurs bénévoles",
 			"voldev": "Développeurs bénévoles",
-			"council": "Community Council",
 			"bot": "Robot",
 			"bot": "Robot",
 			"bureaucrat": "Bureaucrate",
 			"bureaucrat": "Bureaucrate",
 			"sysop": "Administrateur",
 			"sysop": "Administrateur",

+ 0 - 1
i18n/nl.json

@@ -105,7 +105,6 @@
 			"global-discussions-moderator": "Globaal discussiemoderator",
 			"global-discussions-moderator": "Globaal discussiemoderator",
 			"vanguard": "Vanguard",
 			"vanguard": "Vanguard",
 			"voldev": "Vrijwillige ontwikkelaars",
 			"voldev": "Vrijwillige ontwikkelaars",
-			"council": "Communityraad",
 			"bot": "Bot",
 			"bot": "Bot",
 			"bureaucrat": "Bureaucraat",
 			"bureaucrat": "Bureaucraat",
 			"sysop": "Beheerder",
 			"sysop": "Beheerder",

+ 0 - 1
i18n/pl.json

@@ -197,7 +197,6 @@
 			"global-discussions-moderator": "globalny moderator dyskusji",
 			"global-discussions-moderator": "globalny moderator dyskusji",
 			"vanguard": "Vanguard",
 			"vanguard": "Vanguard",
 			"voldev": "Volunteer Developer",
 			"voldev": "Volunteer Developer",
-			"council": "Community Council",
 			"bot": "Bot",
 			"bot": "Bot",
 			"bureaucrat": "Biurokrata",
 			"bureaucrat": "Biurokrata",
 			"sysop": "Administrator",
 			"sysop": "Administrator",

+ 0 - 1
i18n/pt.json

@@ -184,7 +184,6 @@
 			"global-discussions-moderator": "Moderador global de discussões",
 			"global-discussions-moderator": "Moderador global de discussões",
 			"vanguard": "Vanguarda",
 			"vanguard": "Vanguarda",
 			"voldev": "Programadores Voluntários",
 			"voldev": "Programadores Voluntários",
-			"council": "Conselho da Comunidade",
 			"bot": "Robô",
 			"bot": "Robô",
 			"bureaucrat": "Burocrata",
 			"bureaucrat": "Burocrata",
 			"sysop": "Administrador",
 			"sysop": "Administrador",

+ 0 - 2
i18n/ru.json

@@ -176,8 +176,6 @@
 			"content-volunteer": "Контент-доброволец",
 			"content-volunteer": "Контент-доброволец",
 			"global-discussions-moderator": "Глобальный модератор дискуссий",
 			"global-discussions-moderator": "Глобальный модератор дискуссий",
 			"vanguard": "Vanguard",
 			"vanguard": "Vanguard",
-			"voldev": "Volunteer Developer",
-			"council": "Community Council",
 			"bot": "Бот",
 			"bot": "Бот",
 			"bureaucrat": "Бюрократ",
 			"bureaucrat": "Бюрократ",
 			"sysop": "Администратор",
 			"sysop": "Администратор",

+ 0 - 1
i18n/tr.json

@@ -105,7 +105,6 @@
 			"global-discussions-moderator": "Global tartışma moderatörü",
 			"global-discussions-moderator": "Global tartışma moderatörü",
 			"vanguard": "Vanguard",
 			"vanguard": "Vanguard",
 			"voldev": "Gönüllü Geliştirici",
 			"voldev": "Gönüllü Geliştirici",
-			"council": "Topluluk Konseyi",
 			"bot": "Bot",
 			"bot": "Bot",
 			"bureaucrat": "Bürokrat",
 			"bureaucrat": "Bürokrat",
 			"sysop": "Yönetici",
 			"sysop": "Yönetici",

+ 0 - 1
i18n/zh.json

@@ -194,7 +194,6 @@
 			"global-discussions-moderator": "全域讨论版主",
 			"global-discussions-moderator": "全域讨论版主",
 			"vanguard": "Vanguard",
 			"vanguard": "Vanguard",
 			"voldev": "志愿开发者",
 			"voldev": "志愿开发者",
-			"council": "社区委员会",
 			"bot": "机器人",
 			"bot": "机器人",
 			"bureaucrat": "行政员",
 			"bureaucrat": "行政员",
 			"sysop": "管理员",
 			"sysop": "管理员",

+ 0 - 1
util/default.json

@@ -48,7 +48,6 @@
 		"global-discussions-moderator",
 		"global-discussions-moderator",
 		"vanguard",
 		"vanguard",
 		"voldev",
 		"voldev",
-		"council",
 		"bot",
 		"bot",
 		"checkuser",
 		"checkuser",
 		"bureaucrat",
 		"bureaucrat",

+ 10 - 8
util/i18n.js

@@ -53,14 +53,16 @@ class Lang {
 			if ( text ) {
 			if ( text ) {
 				text = text?.[keys[n]];
 				text = text?.[keys[n]];
 			}
 			}
-			else if ( fallback < this.fallback.length ) {
-				lang = this.fallback[fallback];
-				fallback++;
-				text = i18n?.[lang];
-				n = 0;
-			}
-			else {
-				n = keys.length;
+			if ( !text ) {
+				if ( fallback < this.fallback.length ) {
+					lang = this.fallback[fallback];
+					fallback++;
+					text = i18n?.[lang];
+					n = -1;
+				}
+				else {
+					n = keys.length;
+				}
 			}
 			}
 		}
 		}
 		if ( typeof text === 'string' ) {
 		if ( typeof text === 'string' ) {