Browse Source

add more known sites

Markus-Rost 3 years ago
parent
commit
e8abe37132
3 changed files with 115 additions and 18 deletions
  1. 109 13
      util/default.json
  2. 1 1
      util/logging.js
  3. 5 4
      util/newMessage.js

+ 109 - 13
util/default.json

@@ -220,6 +220,90 @@
 			"articlePath": "/w/",
 			"scriptPath": "/"
 		},
+		{
+			"name": "stardewvalleywiki.com",
+			"regex": "((?:[a-z-]{2,12}\\.)?stardewvalleywiki\\.com)",
+			"articlePath": "/",
+			"scriptPath": "/mediawiki/"
+		},
+		{
+			"name": "metin2.gameforge.com",
+			"regex": "([a-z]{2}-wiki\\.metin2\\.gameforge\\.com)",
+			"articlePath": "/index.php/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "psu-clementine.net",
+			"regex": "((?:www\\.)?psu-clementine\\.net)",
+			"articlePath": "/wiki/index.php/",
+			"scriptPath": "/wiki/"
+		},
+		{
+			"name": "ddowiki.com",
+			"regex": "((?:www\\.)?ddowiki\\.com)",
+			"articlePath": "/page/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "bakugan.wiki",
+			"regex": "((?:www\\.)?bakugan\\.wiki)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "wiki.melvoridle.com",
+			"regex": "(wiki\\.melvoridle\\.com)",
+			"articlePath": "/w/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "moegirl.org.cn",
+			"regex": "([a-z-]{2,12}\\.moegirl\\.org\\.cn)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "wiki-aventurica.de",
+			"regex": "((?:[a-z-]{2,12}\\.)?wiki-aventurica\\.de)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/de/"
+		},
+		{
+			"name": "pnpwiki.de",
+			"regex": "((?:www\\.)?pnpwiki\\.de)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/w/"
+		},
+		{
+			"name": "blaseball.wiki",
+			"regex": "((?:www\\.)?blaseball\\.wiki)",
+			"articlePath": "/w/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "gbf.wiki",
+			"regex": "((?:www\\.)?gbf\\.wiki)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "wiki.albiononline.com",
+			"regex": "(wiki\\.albiononline\\.com)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "atitd.wiki",
+			"regex": "((?:www\\.)?atitd\\.wiki)",
+			"articlePath": "/tale10/",
+			"scriptPath": "/tale10/w/"
+		},
+		{
+			"name": "atitd.wiki",
+			"regex": "((?:www\\.)?atitd\\.wiki)",
+			"articlePath": "/tale10/",
+			"scriptPath": "/tale10/w/"
+		},
 		{
 			"name": "niwanetwork.org",
 			"regex": "((?:www\\.)?niwanetwork\\.org)",
@@ -437,10 +521,22 @@
 			"scriptPath": "/w/"
 		},
 		{
-			"name": "chronowiki.org",
-			"regex": "((?:www\\.)?chronowiki\\.org)",
-			"articlePath": "/wiki/",
-			"scriptPath": "/w/"
+			"name": "halopedia.org",
+			"regex": "((?:www\\.)?halopedia\\.org)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "jojowiki.com",
+			"regex": "((?:www\\.)?jojowiki\\.com)",
+			"articlePath": "/",
+			"scriptPath": "/"
+		},
+		{
+			"name": "wikimon.net",
+			"regex": "((?:www\\.)?wikimon\\.net)",
+			"articlePath": "/",
+			"scriptPath": "/"
 		},
 		{
 			"name": "khwiki.com",
@@ -448,6 +544,12 @@
 			"articlePath": "/",
 			"scriptPath": "/"
 		},
+		{
+			"name": "chronowiki.org",
+			"regex": "((?:www\\.)?chronowiki\\.org)",
+			"articlePath": "/wiki/",
+			"scriptPath": "/w/"
+		},
 		{
 			"name": "finalfantasywiki.com",
 			"regex": "((?:www\\.)?finalfantasywiki\\.com)",
@@ -479,16 +581,10 @@
 			"scriptPath": "/w/"
 		},
 		{
-			"name": "wiki-aventurica.de",
-			"regex": "((?:[a-z\\d-]{1,50}\\.)?wiki-aventurica\\.de)",
-			"articlePath": "/wiki/",
-			"scriptPath": "/de/"
-		},
-		{
-			"name": "pnpwiki.de",
-			"regex": "((?:www\\.)?pnpwiki\\.de)",
+			"name": "lakeus.xyz",
+			"regex": "(lakeus\\.xyz)",
 			"articlePath": "/wiki/",
-			"scriptPath": "/w/"
+			"scriptPath": "/"
 		}
 	]
 }

+ 1 - 1
util/logging.js

@@ -17,7 +17,7 @@ usageLog.on( 'error', (error) => {
  * @param {String[]} [notes] - The notes about the usage.
  */
 function logging(wiki, guild, ...notes) {
-	usageLog.write( [new Date().toISOString(), wiki.href, ( guild || 'DM' ), ...notes].join('\t') + '\n', 'utf8' );
+	usageLog.write( [new Date().toISOString(), wiki, ( guild || 'DM' ), ...notes].join('\t') + '\n', 'utf8' );
 }
 
 module.exports = logging;

+ 5 - 4
util/newMessage.js

@@ -1,3 +1,4 @@
+const {domainToASCII} = require('url');
 const {Util} = require('discord.js');
 const logging = require('./logging.js');
 const {got, partialURIdecode} = require('./functions.js');
@@ -84,22 +85,22 @@ function newMessage(msg, lang, wiki = defaultSettings.wiki, prefix = process.env
 		if ( ownercmd ) return ownercmdmap[aliasInvoke](lang, msg, args, line, wiki);
 		if ( pausecmd ) return pausecmdmap[aliasInvoke](lang, msg, args, line, wiki);
 		if ( cmdmap.hasOwnProperty(aliasInvoke) ) return cmdmap[aliasInvoke](lang, msg, args, line, wiki);
-		if ( /^![a-z\d-]{1,50}$/.test(invoke) ) {
+		if ( invoke.startsWith( '!' ) && /^![a-z\d-]{1,50}$/.test(invoke) ) {
 			return cmdmap.LINK(lang, msg, args.join(' '), new Wiki('https://' + invoke.substring(1) + '.gamepedia.com/'), invoke + ' ');
 		}
-		if ( /^\?(?:[a-z-]{2,12}\.)?[a-z\d-]{1,50}$/.test(invoke) ) {
+		if ( invoke.startsWith( '?' ) && /^\?(?:[a-z-]{2,12}\.)?[a-z\d-]{1,50}$/.test(invoke) ) {
 			let invokeWiki = wiki;
 			if ( invoke.includes( '.' ) ) invokeWiki = 'https://' + invoke.split('.')[1] + '.fandom.com/' + invoke.substring(1).split('.')[0] + '/';
 			else invokeWiki = 'https://' + invoke.substring(1) + '.fandom.com/';
 			return cmdmap.LINK(lang, msg, args.join(' '), new Wiki(invokeWiki), invoke + ' ');
 		}
-		if ( /^\?\?(?:[a-z-]{2,12}\.)?[a-z\d-]{1,50}$/.test(invoke) ) {
+		if ( invoke.startsWith( '??' ) && /^\?\?(?:[a-z-]{2,12}\.)?[a-z\d-]{1,50}$/.test(invoke) ) {
 			let invokeWiki = wiki;
 			if ( invoke.includes( '.' ) ) invokeWiki = 'https://' + invoke.split('.')[1] + '.wikia.org/' + invoke.substring(2).split('.')[0] + '/';
 			else invokeWiki = 'https://' + invoke.substring(2) + '.wikia.org/';
 			return cmdmap.LINK(lang, msg, args.join(' '), new Wiki(invokeWiki), invoke + ' ');
 		}
-		if ( /^!!(?:[a-z\d-]{1,50}\.)?[a-z\d-]{1,50}\.[a-z\d-]{1,10}(?:\/|$)/.test(invoke) ) {
+		if ( invoke.startsWith( '!!' ) && /^!!(?:[a-z\d-]{1,50}\.)?[a-z\d-]{1,50}\.[a-z\d-]{1,10}(?:\/|$)/.test(domainToASCII(invoke)) ) {
 			let project = wikiProjects.find( project => invoke.split('/')[0].endsWith( project.name ) );
 			if ( project ) {
 				let regex = invoke.match( new RegExp( project.regex ) );