aboutsummaryrefslogtreecommitdiff
path: root/commands/util
diff options
context:
space:
mode:
Diffstat (limited to 'commands/util')
-rw-r--r--commands/util/defaults/ticket-create.js.json2
-rw-r--r--commands/util/emote.js6
-rw-r--r--commands/util/ticket-create.js29
3 files changed, 36 insertions, 1 deletions
diff --git a/commands/util/defaults/ticket-create.js.json b/commands/util/defaults/ticket-create.js.json
new file mode 100644
index 0000000..7fa5b02
--- /dev/null
+++ b/commands/util/defaults/ticket-create.js.json
@@ -0,0 +1,2 @@
+{"cooldown":-1,"desc":"Create a private ticket thread","restrict":["874305842965516339"],"restricted":[],
+"usage":"{command} [title]"} \ No newline at end of file
diff --git a/commands/util/emote.js b/commands/util/emote.js
index b06bbef..c88f0b4 100644
--- a/commands/util/emote.js
+++ b/commands/util/emote.js
@@ -19,7 +19,11 @@ module.exports = {
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")})
+ let emote = interaction.options.getString("emote");
+ if(Object.keys(config.avaliable_multi).includes(emote)||Object.keys(config.avaliable_solo).includes(emote))
+ this.exec(client,{message:interaction,emote:emote,mentioned:interaction.options.getUser("user")})
+ else
+ interaction.reply({content:"invalid emote!", ephemeral: true})
},
async exec(client,param){
let msg = "";
diff --git a/commands/util/ticket-create.js b/commands/util/ticket-create.js
new file mode 100644
index 0000000..3264568
--- /dev/null
+++ b/commands/util/ticket-create.js
@@ -0,0 +1,29 @@
+const fs = require('fs')
+const path = require("path");
+let config_loc = __filename+".json"
+const { PermissionsBitField, ChannelType } = require('discord.js');
+let config = JSON.parse(fs.readFileSync(config_loc))
+module.exports = {
+ name : "ticket-create",
+ command: ["ticket-create"],
+ mod_only: false,
+ config:config,
+ config_loc:config_loc,
+ async main (client,Discord,message,args){
+ this.exec(client,{message:message,thread_name:args[0] ?? 'created by '+message.author.username})
+ },
+ s_options:[{type:"string",name:"title",desc:"thread title",required:false,autocomplete:false}],
+ async s_main (client,Discord,interaction){
+ this.exec(client,{message:interaction,thread_name:interaction.options.getString("title")??'created by '+interaction.author.user.username})
+ },
+ async exec(client,info){
+ let thread = await client.channels.cache.get(info.message.channelId).threads.create({
+ name: info.thread_name,
+ autoArchiveDuration: 60,
+ reason: 'created by <@'+info.message.author.id+'>',
+ type: ChannelType.PrivateThread,
+ })
+ await thread.members.add(info.message.author.id)
+ await info.message.reply({content:"created <#"+thread.id+">"})
+ }
+} \ No newline at end of file