|
@@ -550,9 +550,14 @@ function check_wiki(lang, msg, title, wiki, cmd, reaction, spoiler = '', queryst
|
|
querypage.ns = -1;
|
|
querypage.ns = -1;
|
|
}
|
|
}
|
|
|
|
|
|
- if ( ( querypage.ns === 2 || querypage.ns === 202 ) && ( !querypage.title.includes( '/' ) || /^[^:]+:[\d\.]+\/\d\d$/.test(querypage.title) ) ) {
|
|
|
|
|
|
+ var contribs = body.query.namespaces['-1']['*'] + ':' + body.query.specialpagealiases.find( sp => sp.realname === 'Contributions' ).aliases[0] + '/';
|
|
|
|
+ if ( ( querypage.ns === 2 || querypage.ns === 202 ) && ( !querypage.title.includes( '/' ) || /^[^:]+:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\/\d\d$/.test(querypage.title) ) ) {
|
|
var userparts = querypage.title.split(':');
|
|
var userparts = querypage.title.split(':');
|
|
- cmd_user(lang, msg, userparts[0].toTitle() + ':', userparts.slice(1).join(':'), wiki, linksuffix, reaction, spoiler);
|
|
|
|
|
|
+ cmd_user(lang, msg, userparts[0].toTitle() + ':', userparts.slice(1).join(':'), wiki, linksuffix, noRedirect, contribs.toTitle(), reaction, spoiler);
|
|
|
|
+ }
|
|
|
|
+ else if ( querypage.ns === -1 && querypage.title.startsWith(contribs) && querypage.title.length > contribs.length ) {
|
|
|
|
+ var userparts = querypage.title.split('/');
|
|
|
|
+ cmd_user(lang, msg, userparts[0].toTitle() + '/', userparts.slice(1).join('/'), wiki, linksuffix, noRedirect, contribs.toTitle(), reaction, spoiler);
|
|
}
|
|
}
|
|
else if ( ( querypage.missing !== undefined && querypage.known === undefined && !( noRedirect || querypage.categoryinfo ) ) || querypage.invalid !== undefined ) {
|
|
else if ( ( querypage.missing !== undefined && querypage.known === undefined && !( noRedirect || querypage.categoryinfo ) ) || querypage.invalid !== undefined ) {
|
|
request( {
|
|
request( {
|
|
@@ -727,8 +732,8 @@ function cmd_umfrage(lang, msg, args, line) {
|
|
for ( var i = 0; ( i < args.length || imgs.length ); i++ ) {
|
|
for ( var i = 0; ( i < args.length || imgs.length ); i++ ) {
|
|
var reaction = args[i];
|
|
var reaction = args[i];
|
|
var custom = /^<a?:/;
|
|
var custom = /^<a?:/;
|
|
- var pattern = /^[\u0000-\u1FFF]{1,2}$/;
|
|
|
|
- if ( !custom.test(reaction) && ( reaction.length > 2 || pattern.test(reaction) ) ) {
|
|
|
|
|
|
+ var pattern = /^[\u0000-\u1FFF]{1,4}$/;
|
|
|
|
+ if ( !custom.test(reaction) && ( reaction.length > 4 || pattern.test(reaction) ) ) {
|
|
cmd_sendumfrage(lang, msg, args.slice(i).join(' ').replace( /^\n| (\n)/, '$1' ), reactions, imgs);
|
|
cmd_sendumfrage(lang, msg, args.slice(i).join(' ').replace( /^\n| (\n)/, '$1' ), reactions, imgs);
|
|
break;
|
|
break;
|
|
} else if ( reaction === '' ) {
|
|
} else if ( reaction === '' ) {
|
|
@@ -769,7 +774,7 @@ function cmd_sendumfrage(lang, msg, text, reactions, imgs) {
|
|
} );
|
|
} );
|
|
}
|
|
}
|
|
|
|
|
|
-function cmd_user(lang, msg, namespace, username, wiki, linksuffix, reaction, spoiler) {
|
|
|
|
|
|
+function cmd_user(lang, msg, namespace, username, wiki, linksuffix, noRedirect, contribs, reaction, spoiler) {
|
|
if ( /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:\/\d\d)?$/.test(username) ) {
|
|
if ( /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(?:\/\d\d)?$/.test(username) ) {
|
|
request( {
|
|
request( {
|
|
uri: 'https://' + wiki + '.gamepedia.com/api.php?action=query&meta=siteinfo&siprop=general&list=blocks&bkprop=user|by|timestamp|expiry|reason&bkip=' + encodeURIComponent( username ) + '&format=json',
|
|
uri: 'https://' + wiki + '.gamepedia.com/api.php?action=query&meta=siteinfo&siprop=general&list=blocks&bkprop=user|by|timestamp|expiry|reason&bkip=' + encodeURIComponent( username ) + '&format=json',
|
|
@@ -786,12 +791,13 @@ function cmd_user(lang, msg, namespace, username, wiki, linksuffix, reaction, sp
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
console.log( '- Fehler beim Erhalten der Suchergebnisse' + ( error ? ': ' + error : ( body ? ( body.error ? ': ' + body.error.info : '.' ) : '.' ) ) );
|
|
console.log( '- Fehler beim Erhalten der Suchergebnisse' + ( error ? ': ' + error : ( body ? ( body.error ? ': ' + body.error.info : '.' ) : '.' ) ) );
|
|
- msg.sendChannelError( spoiler + '<https://' + wiki + '.gamepedia.com/Special:Contributions/' + username.toTitle() + '>' + spoiler );
|
|
|
|
|
|
+ msg.sendChannelError( spoiler + '<https://' + wiki + '.gamepedia.com/' + ( noRedirect ? namespace : contribs ) + username.toTitle() + linksuffix + '>' + spoiler );
|
|
}
|
|
}
|
|
|
|
|
|
if ( reaction ) reaction.removeEmoji();
|
|
if ( reaction ) reaction.removeEmoji();
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
|
|
+ if ( !noRedirect ) namespace = contribs;
|
|
var blocks = body.query.blocks.map( function(block) {
|
|
var blocks = body.query.blocks.map( function(block) {
|
|
var isBlocked = false;
|
|
var isBlocked = false;
|
|
var blockedtimestamp = (new Date(block.timestamp)).toLocaleString(lang.user.dateformat, timeoptions);
|
|
var blockedtimestamp = (new Date(block.timestamp)).toLocaleString(lang.user.dateformat, timeoptions);
|
|
@@ -823,16 +829,16 @@ function cmd_user(lang, msg, namespace, username, wiki, linksuffix, reaction, sp
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
console.log( '- Fehler beim Erhalten der Suchergebnisse' + ( ucerror ? ': ' + ucerror : ( ucbody ? ( ucbody.error ? ': ' + ucbody.error.info : '.' ) : '.' ) ) );
|
|
console.log( '- Fehler beim Erhalten der Suchergebnisse' + ( ucerror ? ': ' + ucerror : ( ucbody ? ( ucbody.error ? ': ' + ucbody.error.info : '.' ) : '.' ) ) );
|
|
- msg.sendChannelError( spoiler + '<https://' + wiki + '.gamepedia.com/Special:Contributions/' + username.toTitle() + '>' + spoiler );
|
|
|
|
|
|
+ msg.sendChannelError( spoiler + '<https://' + wiki + '.gamepedia.com/' + namespace + username.toTitle() + linksuffix + '>' + spoiler );
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
var editcount = [lang.user.info.editcount, ( username.includes( '/' ) && range !== 24 && range !== 16 ? '~' : '' ) + ucbody.query.usercontribs.length + ( ucbody.continue ? '+' : '' )];
|
|
var editcount = [lang.user.info.editcount, ( username.includes( '/' ) && range !== 24 && range !== 16 ? '~' : '' ) + ucbody.query.usercontribs.length + ( ucbody.continue ? '+' : '' )];
|
|
|
|
|
|
- var pagelink = 'https://' + wiki + '.gamepedia.com/Special:Contributions/' + username.toTitle();
|
|
|
|
|
|
+ var pagelink = 'https://' + wiki + '.gamepedia.com/' + namespace + username.toTitle() + linksuffix;
|
|
if ( msg.showEmbed() ) {
|
|
if ( msg.showEmbed() ) {
|
|
var text = '<' + pagelink + '>';
|
|
var text = '<' + pagelink + '>';
|
|
- var embed = new Discord.RichEmbed().setAuthor( body.query.general.sitename ).setTitle( username ).setURL( pagelink ).addField( editcount[0], editcount[1] );
|
|
|
|
|
|
+ var embed = new Discord.RichEmbed().setAuthor( body.query.general.sitename ).setTitle( username ).setURL( pagelink ).addField( editcount[0], '[' + editcount[1] + '](https://' + wiki + '.gamepedia.com/' + contribs + username.toTitle() + ')' );
|
|
if ( blocks.length ) blocks.forEach( block => embed.addField( block[0], block[1].toMarkdown(wiki) ) );
|
|
if ( blocks.length ) blocks.forEach( block => embed.addField( block[0], block[1].toMarkdown(wiki) ) );
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
@@ -911,7 +917,7 @@ function cmd_user(lang, msg, namespace, username, wiki, linksuffix, reaction, sp
|
|
var pagelink = 'https://' + wiki + '.gamepedia.com/' + namespace + username.toTitle() + linksuffix;
|
|
var pagelink = 'https://' + wiki + '.gamepedia.com/' + namespace + username.toTitle() + linksuffix;
|
|
if ( msg.showEmbed() ) {
|
|
if ( msg.showEmbed() ) {
|
|
var text = '<' + pagelink + '>';
|
|
var text = '<' + pagelink + '>';
|
|
- var embed = new Discord.RichEmbed().setAuthor( body.query.general.sitename ).setTitle( username.escapeFormatting() ).setURL( pagelink ).addField( editcount[0], editcount[1], true ).addField( group[0], group[1], true ).addField( gender[0], gender[1], true ).addField( registration[0], registration[1], true );
|
|
|
|
|
|
+ var embed = new Discord.RichEmbed().setAuthor( body.query.general.sitename ).setTitle( username.escapeFormatting() ).setURL( pagelink ).addField( editcount[0], '[' + editcount[1] + '](https://' + wiki + '.gamepedia.com/' + contribs + username.toTitle() + ')', true ).addField( group[0], group[1], true ).addField( gender[0], gender[1], true ).addField( registration[0], registration[1], true );
|
|
if ( isBlocked ) embed.addField( block[0], block[1].toMarkdown(wiki) );
|
|
if ( isBlocked ) embed.addField( block[0], block[1].toMarkdown(wiki) );
|
|
}
|
|
}
|
|
else {
|
|
else {
|