Markus-Rost преди 3 години
родител
ревизия
31fdaef8fc
променени са 2 файла, в които са добавени 6 реда и са изтрити 5 реда
  1. 1 1
      functions/special_page.js
  2. 5 4
      util/functions.js

+ 1 - 1
functions/special_page.js

@@ -202,7 +202,7 @@ function special_page(lang, msg, {title, uselang = lang.lang}, specialpage, quer
 		if ( msg.channel.isGuild() && patreons[msg.guildId] && querypages.hasOwnProperty(specialpage) ) {
 		if ( msg.channel.isGuild() && patreons[msg.guildId] && querypages.hasOwnProperty(specialpage) ) {
 			var text = Util.splitMessage( querypages[specialpage][1](body.query, wiki, lang), {maxLength:1000} )[0];
 			var text = Util.splitMessage( querypages[specialpage][1](body.query, wiki, lang), {maxLength:1000} )[0];
 			embed.addField( lang.get('search.special'), ( text || lang.get('search.empty') ) );
 			embed.addField( lang.get('search.special'), ( text || lang.get('search.empty') ) );
-			if ( body.query.querypage.cached !== undefined ) {
+			if ( body.query.querypage?.cached !== undefined ) {
 				embed.setFooter( lang.get('search.cached') ).setTimestamp(new Date(body.query.querypage.cachedtimestamp));
 				embed.setFooter( lang.get('search.cached') ).setTimestamp(new Date(body.query.querypage.cachedtimestamp));
 			}
 			}
 		}
 		}

+ 5 - 4
util/functions.js

@@ -435,10 +435,11 @@ function partialURIdecode(m) {
  * @param {String} author - The user id.
  * @param {String} author - The user id.
  */
  */
 function allowDelete(msg, author) {
 function allowDelete(msg, author) {
-	msg?.awaitReactions?.( {filter: (reaction, user) => ( reaction.emoji.name === '🗑️' && user.id === author ), max: 1, time: 300000} ).then( reaction => {
-		if ( reaction.size ) {
-			msg.delete().catch(log_error);
-		}
+	msg?.awaitReactions?.( {
+		filter: (reaction, user) => ( reaction.emoji.name === '🗑️' && user.id === author ),
+		max: 1, time: 300000
+	} ).then( reaction => {
+		if ( reaction.size ) msg.delete().catch(log_error);
 	} );
 	} );
 };
 };