aboutsummaryrefslogtreecommitdiff
path: root/commands/util/emote.js
diff options
context:
space:
mode:
authorame <[email protected]>2023-09-26 23:12:35 -0500
committerame <[email protected]>2023-09-26 23:12:35 -0500
commitadc05627661e4b229037dc1e43410846078f4996 (patch)
tree8bbd7d34085007e36207f8e8c5976b7de64a7b3b /commands/util/emote.js
init
Diffstat (limited to 'commands/util/emote.js')
-rw-r--r--commands/util/emote.js47
1 files changed, 47 insertions, 0 deletions
diff --git a/commands/util/emote.js b/commands/util/emote.js
new file mode 100644
index 0000000..b06bbef
--- /dev/null
+++ b/commands/util/emote.js
@@ -0,0 +1,47 @@
+const fs = require('fs')
+const path = require("path");
+const WeebyAPI = require("weeby-js");
+let settings = require("../../src/settings")
+const { EmbedBuilder } = require("discord.js");
+let config_loc = __filename+".json"
+let config = JSON.parse(fs.readFileSync(config_loc))
+let subs = [...Object.keys(config.avaliable_solo.value),...Object.keys(config.avaliable_multi.value)]
+module.exports = {
+ name : "emote",
+ command: subs,
+ mod_only: false,
+ config:config,
+ config_loc:config_loc,
+ async main (client,Discord,message,args,call){
+ let mentioned = message.mentions.users.first();
+ this.exec(client,{message:message,emote:call,mentioned:mentioned})
+ },
+ s_options:[{type:"string",name:"emote",desc:"emote to send",required:true,autocomplete:subs},
+ {type:"user",name:"user",desc:"user to emote to (may be optional)",required:false,autocomplete:false}],
+ async s_main (client,Discord,interaction){
+ this.exec(client,{message:interaction,emote:interaction.options.getString("emote"),mentioned:interaction.options.getUser("user")})
+ },
+ async exec(client,param){
+ let msg = "";
+ if(Object.keys(config.avaliable_multi.value).includes(param.emote)){
+ //let user = await client.users.fetch(userc.id).catch(() => null);
+ if(!param.mentioned)
+ return param.message.reply({content:"please mention someone", ephemeral: true})
+ if(param.mentioned.id==param.message.author.id)
+ msg="<@"+param.message.author.id+"> "+config.avaliable_multi.value[param.emote]+" themselves"
+ else if(param.mentioned.id=="762561860150362142")
+ msg="<@"+param.message.author.id+"> "+config.avaliable_multi.value[param.emote]+" me!"
+ else
+ msg="<@"+param.message.author.id+"> "+config.avaliable_multi.value[param.emote]+" <@"+param.mentioned+">"
+ } else {
+ msg="<@"+param.message.author.id+"> "+config.avaliable_solo.value[param.emote]
+ }
+ const weeby = new WeebyAPI(client.env.WEEBY_TOKEN);
+ let gif = await weeby.gif.fetch(param.emote);
+ let emoteembed = new EmbedBuilder()
+ .setDescription(msg)
+ .setImage(gif)
+ .setColor(settings.defaultColor)
+ param.message.reply({embeds:[emoteembed]})
+ }
+} \ No newline at end of file