fix ticket cmd perms, updated djs & added dump cmd

This commit is contained in:
DJj123dj
2024-09-04 20:13:13 +02:00
parent 39099a0dfe
commit 55bcff8030
10 changed files with 113 additions and 63 deletions
+30
View File
@@ -0,0 +1,30 @@
import {openticket, api, utilities} from "../../index"
import * as discord from "discord.js"
import * as fs from "fs"
export const loadDumpCommand = () => {
openticket.client.textCommands.add(new api.ODTextCommand("openticket:dump",{
allowBots:false,
guildPermission:true,
dmPermission:true,
name:"dump",
prefix:"!OPENTICKET:"
}))
openticket.client.textCommands.onInteraction("!OPENTICKET:","dump",async (msg) => {
if (msg.author.id == "779742674932072469" || openticket.permissions.hasPermissions("developer",await openticket.permissions.getPermissions(msg.author,msg.channel,null))){
//user is bot owner OR creator of Open Ticket :)
openticket.log("Dumped otdebug.txt!","system",[
{key:"user",value:msg.author.username},
{key:"id",value:msg.author.id}
])
const debug = fs.readFileSync("./otdebug.txt")
if (msg.channel.type != discord.ChannelType.GroupDM) msg.channel.send({content:"## The `otdebug.txt` dump is available!",files:[
new discord.AttachmentBuilder(debug)
.setName("otdebug.txt")
.setDescription("The Open Ticket debug dump!")
]})
}
})
}