|
@@ -1356,7 +1356,7 @@ function cmd_bug(lang, mclang, msg, args, title, cmd, querystring, fragment, rea
|
|
|
} );
|
|
|
}
|
|
|
else if ( invoke && invoke.toLowerCase() === 'version' && args.length && args.join(' ').length < 100 ) {
|
|
|
- var jql = encodeURIComponent( 'fixVersion="' + args.join(' ') + '"order by key' );
|
|
|
+ var jql = encodeURIComponent( 'fixVersion="' + args.join(' ') + '" order by key' );
|
|
|
request( {
|
|
|
uri: 'https://bugs.mojang.com/rest/api/2/search?fields=summary,resolution,status&jql=' + jql + '&maxResults=25',
|
|
|
json: true
|
|
@@ -1628,11 +1628,10 @@ Discord.MessageReaction.prototype.removeEmoji = function() {
|
|
|
|
|
|
Discord.Message.prototype.sendChannel = function(content, options, ignorePause = false) {
|
|
|
if ( this.channel.type !== 'text' || !pause[this.guild.id] || ( ignorePause && ( this.isAdmin() || this.isOwner() ) ) ) {
|
|
|
- return this.channel.send(content, options).then(msg => {
|
|
|
- if ( !( msg instanceof Discord.Message ) ) {
|
|
|
- log_error({name:'Message is not a message',message:'\n\u200b' + util.inspect( msg ).replace( /\n/g, '\n\u200b' )}, true, 'Sending');
|
|
|
- } else return msg;
|
|
|
- }, log_error);
|
|
|
+ return this.channel.send(content, options).then( msg => {
|
|
|
+ msg.allowDelete(this.author.id);
|
|
|
+ return msg;
|
|
|
+ }, log_error );
|
|
|
} else {
|
|
|
console.log( '- Aborted, paused.' );
|
|
|
return Promise.resolve();
|
|
@@ -1640,16 +1639,19 @@ Discord.Message.prototype.sendChannel = function(content, options, ignorePause =
|
|
|
};
|
|
|
|
|
|
Discord.Message.prototype.sendChannelError = function(content, options) {
|
|
|
- return this.channel.send(content, options).then( message => message.reactEmoji('error'), log_error );
|
|
|
+ return this.channel.send(content, options).then( msg => {
|
|
|
+ msg.reactEmoji('error');
|
|
|
+ msg.allowDelete(this.author.id);
|
|
|
+ return msg;
|
|
|
+ }, log_error );
|
|
|
};
|
|
|
|
|
|
Discord.Message.prototype.replyMsg = function(content, options, ignorePause = false) {
|
|
|
if ( this.channel.type !== 'text' || !pause[this.guild.id] || ( ignorePause && ( this.isAdmin() || this.isOwner() ) ) ) {
|
|
|
- return this.reply(content, options).then(msg => {
|
|
|
- if ( !( msg instanceof Discord.Message ) ) {
|
|
|
- log_error({name:'Message is not a message',message:'\n\u200b' + util.inspect( msg ).replace( /\n/g, '\n\u200b' )}, true, 'Sending');
|
|
|
- } else return msg;
|
|
|
- }, log_error);;
|
|
|
+ return this.reply(content, options).then( msg => {
|
|
|
+ msg.allowDelete(this.author.id);
|
|
|
+ return msg;
|
|
|
+ }, log_error );
|
|
|
} else {
|
|
|
console.log( '- Aborted, paused.' );
|
|
|
return Promise.resolve();
|
|
@@ -1660,6 +1662,14 @@ Discord.Message.prototype.deleteMsg = function(timeout = 0) {
|
|
|
return this.delete(timeout).catch(log_error);
|
|
|
};
|
|
|
|
|
|
+Discord.Message.prototype.allowDelete = function(author) {
|
|
|
+ return this.awaitReactions( (reaction, user) => reaction.emoji.name === '🗑' && user.id === author, {max:1,time:30000} ).then( reaction => {
|
|
|
+ if ( reaction.size ) {
|
|
|
+ this.deleteMsg();
|
|
|
+ }
|
|
|
+ } );
|
|
|
+};
|
|
|
+
|
|
|
String.prototype.hasPrefix = function(flags = '') {
|
|
|
if ( RegExp( '^' + process.env.prefix + '(?: |$)', flags ).test(this.toLowerCase()) ) return true;
|
|
|
else return false;
|