Selaa lähdekoodia

add more known wiki sites

Markus-Rost 3 vuotta sitten
vanhempi
sitoutus
fb97d242a1
3 muutettua tiedostoa jossa 83 lisäystä ja 8 poistoa
  1. 2 2
      cmds/link.js
  2. 3 6
      cmds/test.js
  3. 78 0
      util/default.json

+ 2 - 2
cmds/link.js

@@ -16,11 +16,11 @@ const phabricator = require('../functions/phabricator.js');
 function cmd_link(lang, msg, title, wiki, cmd = '') {
 	if ( msg.isAdmin() && msg.defaultSettings ) help_setup(lang, msg);
 	if ( /^\|\|(?:(?!\|\|).)+\|\|$/.test(title) ) {
-		title = title.substring( 2, title.length - 2);
+		title = title.substring(2, title.length - 2);
 		var spoiler = '||';
 	}
 	if ( /^<[^<>]+>$/.test(title) ) {
-		title = title.substring( 1, title.length - 1);
+		title = title.substring(1, title.length - 1);
 		var noEmbed = true;
 	}
 	msg.reactEmoji('⏳').then( reaction => {

+ 3 - 6
cmds/test.js

@@ -46,11 +46,8 @@ function cmd_test(lang, msg, args, line, wiki) {
 				var body = response.body;
 				if ( body && body.warnings ) log_warn(body.warnings);
 				var ping = ( then - now ).toLocaleString(lang.get('dateformat')) + 'ms';
-				if ( body?.query?.general ) {
-					wiki.updateWiki(body.query.general);
-					embed.addField( wiki.toLink(), ping );
-				}
-				else embed.addField( wiki, ping );
+				if ( body?.query?.general ) wiki.updateWiki(body.query.general);
+				embed.addField( wiki.toLink(), ping );
 				var notice = [];
 				if ( response.statusCode !== 200 || !body?.query?.general ) {
 					if ( wiki.noWiki(response.url, response.statusCode) ) {
@@ -82,7 +79,7 @@ function cmd_test(lang, msg, args, line, wiki) {
 					console.log( '- Error while reaching the wiki: ' + error );
 					ping += ' <:error:505887261200613376>';
 				}
-				embed.addField( wiki, ping );
+				embed.addField( wiki.toLink(), ping );
 			} ).finally( () => {
 				if ( msg.isOwner() ) return msg.client.shard.fetchClientValues('ws.status').then( values => {
 					return '```less\n' + values.map( (status, id) => '[' + id + ']: ' + ( wsStatus[status] || status ) ).join('\n') + '\n```';

+ 78 - 0
util/default.json

@@ -220,6 +220,84 @@
 			"articlePath": "/w/",
 			"scriptPath": "/"
 		},
+		{
+			"name": "mariowiki.com",
+			"regex": "((?:www\\.)?mariowiki\\.com)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "mariowiki.net",
+			"regex": "((?:www\\.)?mariowiki\\.net)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/w/"
+		},
+		{
+			"name": "mariowiki.it",
+			"regex": "((?:www\\.)?mariowiki\\.it)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "ssbwiki.com",
+			"regex": "((?:(?:es|www)\\.)?ssbwiki\\.com)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "nookipedia.com",
+			"regex": "((?:www\\.)?nookipedia\\.com)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/w/"
+		},
+		{
+			"name": "bulbapedia.bulbagarden.net",
+			"regex": "(bulbapedia\\.bulbagarden\\.net)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/w/"
+		},
+		{
+			"name": "pokewiki.de",
+			"regex": "((?:www\\.)?pokewiki\\.de)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "wikidex.net",
+			"regex": "((?:www\\.)?wikidex\\.net)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "pokepedia.fr",
+			"regex": "((?:www\\.)?pokepedia\\.fr)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "wiki.pokemoncentral.it",
+			"regex": "(wiki\\.pokemoncentral\\.it)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "wiki.xn--rckteqa2e.com",
+			"regex": "(wiki\\.xn--rckteqa2e\\.com)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/w/"
+		},
+		{
+			"name": "wiki.ポケモン.com",
+			"regex": "(wiki\\.ポケモン\\.com)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/w/"
+		},
+		{
+			"name": "wiki.52poke.com",
+			"regex": "(wiki\\.52poke\\.com)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/w/"
+		},
 		{
 			"name": "wikihow.com",
 			"regex": "((?:www\\.)?wikihow\\.com)",