Forráskód Böngészése

updated translations

Markus-Rost 6 éve
szülő
commit
4315197189
4 módosított fájl, 42 hozzáadás és 19 törlés
  1. 21 3
      i18n/pl.json
  2. 1 1
      i18n/pt.json
  3. 2 2
      i18n/tr.json
  4. 18 13
      main.js

+ 21 - 3
i18n/pl.json

@@ -125,15 +125,33 @@
 			"empty": "*Ta kategoria jest pusta*",
 			"pages": {
 				"default": "%s stron",
-				"1": "%s strona"
+				"1": "%s strona",
+				"*2": "%s strony",
+				"*3": "%s strony",
+				"*4": "%s strony",
+				"*12": "%s stron",
+				"*13": "%s stron",
+				"*14": "%s stron"
 			},
 			"files": {
 				"default": "%s plików",
-				"1": "%s plik"
+				"1": "%s plik",
+				"*2": "%s pliki",
+				"*3": "%s pliki",
+				"*4": "%s pliki",
+				"*12": "%s plików",
+				"*13": "%s plików",
+				"*14": "%s plików"
 			},
 			"subcats": {
 				"default": "%s kategorii",
-				"1": "%s kategoria"
+				"1": "%s kategoria",
+				"*2": "%s katerorie",
+				"*3": "%s katerorie",
+				"*4": "%s katerorie",
+				"*12": "%s kategorii",
+				"*13": "%s kategorii",
+				"*14": "%s kategorii"
 			}
 		}
 	},

+ 1 - 1
i18n/pt.json

@@ -173,7 +173,7 @@
 		"pause": "**Estou atualmente em pausa neste servidor!**\nSom estes comandos podem ser executados:",
 		"footer": "Se você recebeu uma resposta indesejada, pode reagir com 🗑 para minha mensagem e eu a apagarei.",
 		"list": [
-			{ "cmd": "<termo de pesquisa>", "desc": "Eu vou responder com um link para um artigo correspondente no wiki.", "unsearchable": true },
+			{ "cmd": "<termo de pesquisa>", "desc": "Vou responder com um link para um artigo correspondente no wiki.", "unsearchable": true },
 			{ "cmd": "!<wiki> <termo de pesquisa>", "desc": "Vou responder com um link para um artigo correspondente na wiki da Gamepedia: `https://<wiki>.gamepedia.com/`", "unsearchable": true },
 			{ "cmd": "Usuário:<username>", "desc": "Vou mostrar algumas informações sobre o usuário.", "unsearchable": true },
 			{ "cmd": "diff <diff> [<oldid>]", "desc": "Vou responder com um link para o diff na wiki." },

+ 2 - 2
i18n/tr.json

@@ -178,8 +178,8 @@
 			{ "cmd": "command <Minecraft komutu>", "desc": "Minecraft komutunun sözdizimini ve Minecraft Wiki'deki komutun makalesini içeren bir bağlantıyla cevap vereceğim.", "hide": true, "minecraft": true },
 			{ "cmd": "cmd <Minecraft komutu>", "desc": "Minecraft komutunun sözdizimini ve Minecraft Wiki'deki komutun makalesini içeren bir bağlantıyla cevap vereceğim.", "hide": true, "minecraft": true },
 			{ "cmd": "bug <Minecraft hata>", "desc": "Hatanın Minecraft hata bulucusu'ndaki bağlantısıyla cevap vereceğim.", "minecraft": true },
-			{ "cmd": "sayfa <sayfa adı>", "desc": "I will answer with a direct link to the article in the wiki.", "hide": true },
-			{ "cmd": "page <sayfa adı>", "desc": "I will answer with a direct link to the article in the wiki.", "hide": true },
+			{ "cmd": "sayfa <sayfa adı>", "desc": "Makalenin wikideki bağlantısıyla cevap vereceğim.", "hide": true },
+			{ "cmd": "page <sayfa adı>", "desc": "Makalenin wikideki bağlantısıyla cevap vereceğim.", "hide": true },
 			{ "cmd": "arama <arama terimi>", "desc": "Wikideki makalenin arama sayfasına doğrudan bir bağlantı ile cevap vereceğim.", "hide": true },
 			{ "cmd": "search <arama terimi>", "desc": "Wikideki makalenin arama sayfasına doğrudan bir bağlantı ile cevap vereceğim.", "hide": true },
 			{ "cmd": "bilgi", "desc": "Kendimi tanıtacağım." },

+ 18 - 13
main.js

@@ -7,7 +7,12 @@ const DBL = require('dblapi.js');
 var request = require('request');
 var htmlparser = require('htmlparser2');
 
-var client = new Discord.Client( {disableEveryone:true} );
+var client = new Discord.Client( {
+	messageCacheLifetime: 600,
+	messageSweepInterval: 6000,
+	disableEveryone: true,
+	disabledEvents: ["TYPING_START"]
+} );
 const dbl = new DBL(process.env.dbltoken);
 
 var i18n = require('./i18n/allLangs.json');
@@ -510,7 +515,7 @@ async function cmd_eval(lang, msg, args, line) {
 	} catch ( error ) {
 		var text = error.name + ': ' + error.message;
 	}
-	if ( isDebug ) console.log( '--- EVAL START ---\n\u200b' + text.replace( /\n/g, '\n\u200b' ) + '\n--- EVAL END ---' );
+	if ( isDebug ) console.log( '--- EVAL START ---\n' + text + '\n--- EVAL END ---' );
 	if ( text.length > 2000 ) msg.reactEmoji('✅', true);
 	else msg.sendChannel( '```js\n' + text + '\n```', {split:{prepend:'```js\n',append:'\n```'}}, true );
 }
@@ -748,15 +753,15 @@ function check_wiki(lang, msg, title, wiki, cmd, reaction, spoiler = '', queryst
 										if ( querypage.categoryinfo.size === 0 ) category.push(langCat.empty);
 										if ( querypage.categoryinfo.pages > 0 ) {
 											var pages = querypage.categoryinfo.pages;
-											category.push(( langCat.pages[pages] || langCat.pages.default ).replaceSave( '%s', pages ));
+											category.push(( langCat.pages[pages] || langCat.pages['*' + pages % 100] || langCat.pages['*' + pages % 10] || langCat.pages.default ).replaceSave( '%s', pages ));
 										}
 										if ( querypage.categoryinfo.files > 0 ) {
 											var files = querypage.categoryinfo.files;
-											category.push(( langCat.files[files] || langCat.files.default ).replaceSave( '%s', files ));
+											category.push(( langCat.files[files] || langCat.files['*' + files % 100] || langCat.files['*' + files % 10] || langCat.files.default ).replaceSave( '%s', files ));
 										}
 										if ( querypage.categoryinfo.subcats > 0 ) {
 											var subcats = querypage.categoryinfo.subcats;
-											category.push(( langCat.subcats[subcats] || langCat.subcats.default ).replaceSave( '%s', subcats ));
+											category.push(( langCat.subcats[subcats] || langCat.subcats['*' + subcats % 100] || langCat.subcats['*' + subcats % 10] || langCat.subcats.default ).replaceSave( '%s', subcats ));
 										}
 										if ( msg.showEmbed() ) embed.addField( category[0], category.slice(1).join('\n') );
 										else text += '\n\n' + category.join('\n');
@@ -804,15 +809,15 @@ function check_wiki(lang, msg, title, wiki, cmd, reaction, spoiler = '', queryst
 							if ( querypage.categoryinfo.size === 0 ) category.push(langCat.empty);
 							if ( querypage.categoryinfo.pages > 0 ) {
 								var pages = querypage.categoryinfo.pages;
-								category.push(( langCat.pages[pages] || langCat.pages.default ).replaceSave( '%s', pages ));
+								category.push(( langCat.pages[pages] || langCat.pages['*' + pages % 100] || langCat.pages['*' + pages % 10] || langCat.pages.default ).replaceSave( '%s', pages ));
 							}
 							if ( querypage.categoryinfo.files > 0 ) {
 								var files = querypage.categoryinfo.files;
-								category.push(( langCat.files[files] || langCat.files.default ).replaceSave( '%s', files ));
+								category.push(( langCat.files[files] || langCat.files['*' + files % 100] || langCat.files['*' + files % 10] || langCat.files.default ).replaceSave( '%s', files ));
 							}
 							if ( querypage.categoryinfo.subcats > 0 ) {
 								var subcats = querypage.categoryinfo.subcats;
-								category.push(( langCat.subcats[subcats] || langCat.subcats.default ).replaceSave( '%s', subcats ));
+								category.push(( langCat.subcats[subcats] || langCat.subcats['*' + subcats % 100] || langCat.subcats['*' + subcats % 10] || langCat.subcats.default ).replaceSave( '%s', subcats ));
 							}
 							if ( msg.showEmbed() ) embed.addField( category[0], category.slice(1).join('\n') );
 							else text += '\n\n' + category.join('\n');
@@ -1972,7 +1977,7 @@ String.prototype.toPlaintext = function() {
 };
 
 String.prototype.escapeFormatting = function() {
-	return this.replace( /(`|_|\*|~|<|>|{|}|@|\||\\|\/\/)/g, '\\$1' );
+	return this.replace( /(`|_|\*|~|:|<|>|{|}|@|\||\\|\/\/)/g, '\\$1' );
 };
 
 String.prototype.replaceSave = function(pattern, replacement) {
@@ -2081,7 +2086,7 @@ client.on( 'message', msg => {
 				var args = cont.split(' ').slice(2);
 				if ( cont.split(' ')[1].split('\n')[1] ) args.unshift( '', cont.split(' ')[1].split('\n')[1] );
 				if ( !( ownercmd || aliasInvoke in pausecmdmap ) && pause[msg.guild.id] ) console.log( msg.guild.name + ': Paused' );
-				else console.log( ( msg.guild ? msg.guild.name : '@' + author.username ) + ': ' + cont.replace( /\n/g, '\n\u200b' ) );
+				else console.log( ( msg.guild ? msg.guild.name : '@' + author.username ) + ': ' + cont );
 				if ( ownercmd ) ownercmdmap[aliasInvoke](lang, msg, args, cont);
 				else if ( !pause[msg.guild.id] || aliasInvoke in pausecmdmap ) multilinecmdmap[aliasInvoke](lang, msg, args, cont);
 			} else {
@@ -2209,7 +2214,7 @@ if ( isDebug ) client.on( 'debug', debug => console.log( '- Debug: ' + debug ) )
 function log_error(error, isBig = false, type = '') {
 	var time = new Date(Date.now()).toLocaleTimeString('de-DE', { timeZone: 'Europe/Berlin' });
 	if ( isDebug ) {
-		console.error( '--- ' + type + 'ERROR START ' + time + ' ---\n\u200b' + util.inspect( error ).replace( /\n/g, '\n\u200b' ) + '\n--- ' + type + 'ERROR END ' + time + ' ---' );
+		console.error( '--- ' + type + 'ERROR START ' + time + ' ---\n' + util.inspect( error ) + '\n--- ' + type + 'ERROR END ' + time + ' ---' );
 	} else {
 		if ( isBig ) console.log( '--- ' + type + 'ERROR: ' + time + ' ---\n- ' + error.name + ': ' + error.message );
 		else console.log( '- ' + error.name + ': ' + error.message );
@@ -2218,10 +2223,10 @@ function log_error(error, isBig = false, type = '') {
 
 function log_warn(warning, api = true) {
 	if ( isDebug ) {
-		console.warn( '--- Warning start ---\n\u200b' + util.inspect( warning ).replace( /\n/g, '\n\u200b' ) + '\n--- Warning end ---' );
+		console.warn( '--- Warning start ---\n' + util.inspect( warning ) + '\n--- Warning end ---' );
 	} else {
 		if ( api ) console.warn( '- Warning: ' + Object.keys(warning).join(', ') );
-		else console.warn( '--- Warning ---\n\u200b' + util.inspect( warning ).replace( /\n/g, '\n\u200b' ) );
+		else console.warn( '--- Warning ---\n' + util.inspect( warning ) );
 	}
 }