mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-07 21:53:07 -04:00
better emoji command
This commit is contained in:
parent
505ef034b0
commit
10a70bdb39
1 changed files with 26 additions and 19 deletions
|
@ -31,20 +31,20 @@ module.exports = {
|
|||
if (matches.length) {
|
||||
let form = '.png'
|
||||
if(matches[0].animated) form = '.gif'
|
||||
return editOrReply(context, {embeds:[
|
||||
createEmbed("default", context, {
|
||||
|
||||
return editOrReply(context, createEmbed("default", context, {
|
||||
description: `**${matches[0].name}**`,
|
||||
image: {
|
||||
url: `https://cdn.discordapp.com/emojis/${matches[0].id}${form}`
|
||||
}
|
||||
})
|
||||
]})
|
||||
)
|
||||
} else {
|
||||
const emoji = onlyEmoji(args.emoji)
|
||||
if(!emoji){
|
||||
return editOrReply(context, {embeds:[
|
||||
return editOrReply(context,
|
||||
createEmbed("warning", context, "No emoji found.")
|
||||
]})
|
||||
)
|
||||
}
|
||||
|
||||
// Emoji Mixing
|
||||
|
@ -52,17 +52,15 @@ module.exports = {
|
|||
try{
|
||||
let em = await emojiKitchen(emoji)
|
||||
if(!em.body.results[0]){
|
||||
try{
|
||||
await emojiKitchen([emoji[0]])
|
||||
}catch(e){
|
||||
return editOrReply(context, createEmbed("error", context, `Invalid Emoji (${emoji[0]})`))
|
||||
for(const em of emoji){
|
||||
try{
|
||||
await emojiKitchen([em])
|
||||
}catch(e){
|
||||
return editOrReply(context, createEmbed("error", context, `Invalid Emoji (${em})`))
|
||||
}
|
||||
}
|
||||
try{
|
||||
await emojiKitchen([emoji[1]])
|
||||
}catch(e){
|
||||
return editOrReply(context, createEmbed("error", context, `Invalid Emoji (${emoji[1]})`))
|
||||
}
|
||||
return editOrReply(context, createEmbed("error", context, "Combination not supported"))
|
||||
|
||||
return editOrReply(context, createEmbed("error", context, "Combination not supported."))
|
||||
}
|
||||
return editOrReply(context, createEmbed("image", context, { url: em.body.results[0].url }))
|
||||
|
||||
|
@ -82,16 +80,25 @@ module.exports = {
|
|||
}
|
||||
|
||||
// Regular Emoji Handling
|
||||
if(emoji.length == 0) return await editOrReply(context, createEmbed("warning", context, "You need to specify an emoji to enlarge."))
|
||||
|
||||
if(!SUPPORTED_EMOJI_PLATFORMS.includes(args.type.toLowerCase())){
|
||||
if(!EMOJI_PLATFORM_ALIASES[args.type.toLowerCase()]) return await editOrReply(context, createEmbed("warning", context, "Invalid emoji type"))
|
||||
if(!EMOJI_PLATFORM_ALIASES[args.type.toLowerCase()]) return await editOrReply(context, createEmbed("warning", context, "Invalid platform type (" + args.type.toLowerCase() + ")"))
|
||||
args.type = EMOJI_PLATFORM_ALIASES[args.type.toLowerCase()]
|
||||
}
|
||||
if(emoji.length == 0) return await editOrReply(context, createEmbed("warning", context, "You need to specify an emoji to enlarge"))
|
||||
|
||||
let emojipediaResult = await emojipedia(context, emoji[0])
|
||||
emojipediaResult = emojipediaResult.response.body
|
||||
if(!emojipediaResult.data.vendor_images[args.type]) return await editOrReply(context, createEmbed("error", context, "No image of specified emoji for the requested type"))
|
||||
|
||||
if(!emojipediaResult.data.vendor_images[args.type]){
|
||||
let embed = createEmbed("error", context, "No emoji image available for platform " + args.type.toLowerCase() + ".")
|
||||
embed.footer = {
|
||||
text: "Available platforms: " + Object.keys(emojipediaResult.data.vendor_images).join(', ')
|
||||
}
|
||||
return await editOrReply(context, embed)
|
||||
}
|
||||
|
||||
emojiUrl = emojipediaResult.data.vendor_images[args.type]
|
||||
emojiUrl = emojipediaResult.data.vendor_images[args.type].replace('/thumbs/150/', '/source/')
|
||||
|
||||
return editOrReply(context, {embeds:[
|
||||
createEmbed("default", context, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue