emoji lookup inclusivity leniency

wew big wurd am cool
master
Kit Kasune 4 years ago committed by GitHub
parent b8f0516425
commit 4facf21674
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      commands/misc/emoji.js

@ -45,7 +45,7 @@ module.exports = {
} }
if (!args[0].match(/^<a?:.+:\d+>$|^\d+$/gm)) { if (!args[0].match(/^<a?:.+:\d+>$|^\d+$/gm)) {
if (args[0].length > 25) {return message.channel.send("That doesn't seem to be a valid emoji! (Standard Discord emojis don't count :p )");} if (args[0].length > 25) {return message.channel.send("That doesn't seem to be a valid emoji! (Standard Discord emojis don't count :p )");}
let lookup = client.emojis.cache.filter(e => (args[0].length > 4 && e.name.toLowerCase().includes(args[0].toLowerCase())) || e.name.toLowerCase() === args[0].toLowerCase()); let lookup = client.emojis.cache.filter(e => (args[0].length > 2 && e.name.toLowerCase().includes(args[0].toLowerCase())) || e.name.toLowerCase() === args[0].toLowerCase());
if (!lookup.size) {return message.channel.send("I tried to find some emojis that matched that name, but couldn't find anything. Maybe you didn't give an emoji to begin with?");} if (!lookup.size) {return message.channel.send("I tried to find some emojis that matched that name, but couldn't find anything. Maybe you didn't give an emoji to begin with?");}
let emotes = Array.from(lookup.values()); let emotes = Array.from(lookup.values());
if (lookup.size > 20) { if (lookup.size > 20) {
@ -119,4 +119,4 @@ module.exports = {
return message.channel.send("There was an error getting info for that emoji. You may not have given a valid emoji, or the ID you gave doesn't lead to a real emoji."); return message.channel.send("There was an error getting info for that emoji. You may not have given a valid emoji, or the ID you gave doesn't lead to a real emoji.");
} }
} }
}; };

Loading…
Cancel
Save