mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
emojimix
This commit is contained in:
parent
aa5a4cdfbe
commit
9eb257b28d
2 changed files with 76 additions and 0 deletions
65
commands/message/fun/emojimix.js
Normal file
65
commands/message/fun/emojimix.js
Normal file
|
@ -0,0 +1,65 @@
|
|||
const { Constants } = require("detritus-client");
|
||||
const Permissions = Constants.Permissions;
|
||||
|
||||
const { createEmbed } = require('../../../labscore/utils/embed')
|
||||
const { editOrReply } = require('../../../labscore/utils/message')
|
||||
|
||||
const { emojiKitchen } = require('../../../labscore/api')
|
||||
|
||||
const onlyEmoji = require('emoji-aware').onlyEmoji;
|
||||
|
||||
module.exports = {
|
||||
label: "emoji",
|
||||
name: "emoji",
|
||||
aliases: ["em"],
|
||||
metadata: {
|
||||
description: 'mix two emoji',
|
||||
examples: ['emoji 🐱🍞'],
|
||||
category: 'fun',
|
||||
usage: 'emoji <emoji to mix>'
|
||||
},
|
||||
ratelimit: {
|
||||
type: 'guild',
|
||||
limit: 1,
|
||||
duration: 2000
|
||||
},
|
||||
permissionsClient: [Permissions.EMBED_LINKS],
|
||||
run: async (context, args) => {
|
||||
await context.triggerTyping();
|
||||
|
||||
const emojis = onlyEmoji(args.emoji)
|
||||
|
||||
if(emojis.length <= 1) return editOrReply(context, createEmbed("warning", context, "You need at least two emoji to mix."))
|
||||
|
||||
try{
|
||||
let em = await emojiKitchen(emojis)
|
||||
if(!em.body.results[0]){
|
||||
try{
|
||||
await emojiKitchen([emojis[0]])
|
||||
}catch(e){
|
||||
return editOrReply(context, createEmbed("error", context, `Invalid Emoji (${emojis[0]})`))
|
||||
}
|
||||
try{
|
||||
await emojiKitchen([emojis[1]])
|
||||
}catch(e){
|
||||
return editOrReply(context, createEmbed("error", context, `Invalid Emoji (${emojis[1]})`))
|
||||
}
|
||||
return editOrReply(context, createEmbed("error", context, "Combination not supported"))
|
||||
}
|
||||
return editOrReply(context, createEmbed("image", context, { url: em.body.results[0].url }))
|
||||
|
||||
}catch(e){
|
||||
console.log(e)
|
||||
return context.editOrReply({
|
||||
embed: {
|
||||
author: {
|
||||
iconUrl: context.message.author.avatarUrl,
|
||||
name: `${context.message.author.username}#${context.message.author.discriminator}`
|
||||
},
|
||||
color: Colors.error,
|
||||
description: `${Icons.error} You need two emoji to mix.`,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
};
|
|
@ -265,4 +265,15 @@ module.exports.screenshot = async function(context, url, nsfw){
|
|||
|
||||
module.exports.emojiTwitter = async function(codepoint){
|
||||
return Static.HOST + Static.TWITTER(codepoint)
|
||||
}
|
||||
|
||||
module.exports.emojiKitchen = async function(emoji){
|
||||
return await superagent.get("https://tenor.googleapis.com/v2/featured").query({
|
||||
key: process.env.GOOGLE_TENOR_KEY,
|
||||
contentfilter: "high",
|
||||
media_filter: "png_transparent",
|
||||
component: "proactive",
|
||||
collection: "emoji_kitchen_v5",
|
||||
q: emoji.join('_')
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue