diff options
author | ame <[email protected]> | 2023-10-31 17:24:25 -0500 |
---|---|---|
committer | ame <[email protected]> | 2023-10-31 17:24:25 -0500 |
commit | 53b4e132d593ac6a0d7cad6f0c988a97b68b8d2d (patch) | |
tree | 5db8aa7e1768ecec5fd1b62ea0f995a8067410ed /commands/util/ticket-create.js | |
parent | 350d0de46b90d8a54fbf98ca500a4f88512f7a69 (diff) |
sticky slash command, extended slash commands, and other fixes
Diffstat (limited to 'commands/util/ticket-create.js')
-rw-r--r-- | commands/util/ticket-create.js | 29 |
1 files changed, 29 insertions, 0 deletions
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 |