Code Cleanup & Improved channel rename errors
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET ADD USER SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -34,21 +34,8 @@ export async function registerActions(){
|
||||
opendiscord.log("Failed to add channel permission overwrites on add-ticket-user","error")
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket user adding!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value,hidden:true}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage) await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:add-message").build(origin,{guild,channel,user,ticket,reason,data})).message)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//CALCULATE TICKET CATEGORY SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//CALCULATE TICKET NAME SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET CLAIMING SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -39,7 +39,8 @@ export async function registerActions(){
|
||||
ticket.get("opendiscord:category-mode").value = categoryResult.newCategoryMode
|
||||
ticket.get("opendiscord:category").value = categoryResult.newCategoryId
|
||||
}catch(err){
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-claim",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-claim",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
opendiscord.log("Unable to move ticket to claimed category.","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
@@ -49,21 +50,8 @@ export async function registerActions(){
|
||||
}
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket claiming!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//CLEAR TICKETS SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET CLOSING SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -47,7 +47,8 @@ export async function registerActions(){
|
||||
ticket.get("opendiscord:category-mode").value = categoryResult.newCategoryMode
|
||||
ticket.get("opendiscord:category").value = categoryResult.newCategoryId
|
||||
}catch(err){
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-close",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-close",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
opendiscord.log("Unable to move ticket to closed category.","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
@@ -114,21 +115,8 @@ export async function registerActions(){
|
||||
})
|
||||
channel.permissionOverwrites.set(permissions)
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket closing!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET CREATION SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET CREATION SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
export async function registerActions(){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TRANSCRIPT CREATION SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const transcriptConfig = opendiscord.configs.get("opendiscord:transcripts")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET DELETION SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -20,21 +20,8 @@ export async function registerActions(){
|
||||
ticket.get("opendiscord:for-deletion").value = true
|
||||
ticket.get("opendiscord:busy").value = true
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket deletion!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
if (params.sendMessage) await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:delete-message").build(origin,{guild,channel,user,ticket,reason})).message)
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//TRANSCRIPT ERROR SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -14,16 +14,16 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"delete")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"delete")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch data
|
||||
@@ -57,16 +57,16 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,user} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"delete")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"delete")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch data
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//VERIFYBAR SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
export async function registerButtonResponders(){
|
||||
//HANDLE VERIFYBAR BUTTON
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET MOVING SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -32,7 +32,8 @@ export async function registerActions(){
|
||||
ticket.get("opendiscord:category-mode").value = categoryResult.newCategoryMode
|
||||
ticket.get("opendiscord:category").value = categoryResult.newCategoryId
|
||||
}catch(err){
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-move",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-move",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
opendiscord.log("Unable to move ticket to moved category.","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
@@ -119,25 +120,13 @@ export async function registerActions(){
|
||||
{key:"oldName",value:originalName},
|
||||
{key:"newName",value:newName}
|
||||
])
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-move",{guild,channel,user,originalName,newName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-move",{guild,channel,user,originalName,newName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
}
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket moving!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage) await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:move-message").build(origin,{guild,channel,user,ticket,reason,data})).message)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET PINNING SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -45,25 +45,13 @@ export async function registerActions(){
|
||||
{key:"oldName",value:originalName},
|
||||
{key:"newName",value:newName}
|
||||
])
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-pin",{guild,channel,user,originalName,newName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-pin",{guild,channel,user,originalName,newName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
}
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket pinning!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"message",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//REACTION ROLE SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET REMOVE USER SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -29,20 +29,8 @@ export async function registerActions(){
|
||||
opendiscord.log("Failed to remove channel permission overwrites on remove-ticket-user","error")
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket user removal!","error",[
|
||||
{key:"channel",value:channel.id},
|
||||
{key:"message",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage) await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:remove-message").build(origin,{guild,channel,user,ticket,reason,data})).message)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET RENAMING SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -32,25 +32,13 @@ export async function registerActions(){
|
||||
{key:"oldName",value:originalName},
|
||||
{key:"newName",value:newName}
|
||||
])
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-rename",{guild,channel,user,originalName,newName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-rename",{guild,channel,user,originalName,newName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
}
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket renaming!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage) await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:rename-message").build(origin,{guild,channel,user,ticket,reason,data})).message)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET REOPENING SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -52,7 +52,8 @@ export async function registerActions(){
|
||||
ticket.get("opendiscord:category-mode").value = categoryResult.newCategoryMode
|
||||
ticket.get("opendiscord:category").value = categoryResult.newCategoryId
|
||||
}catch(err){
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-reopen",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-reopen",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
opendiscord.log("Unable to move ticket to reopened category.","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
@@ -113,21 +114,8 @@ export async function registerActions(){
|
||||
})
|
||||
channel.permissionOverwrites.set(permissions)
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket reopening!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
if (params.sendMessage){
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:reopen-message").build(origin,{guild,channel,user,ticket,reason})).message)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET TRANSFER SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -103,25 +103,13 @@ export async function registerActions(){
|
||||
{key:"oldName",value:originalName},
|
||||
{key:"newName",value:newName}
|
||||
])
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-transfer",{guild,channel,user,originalName,newName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-transfer",{guild,channel,user,originalName,newName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
}
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket transferring!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage) await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:transfer-message").build(origin,{guild,channel,user,ticket,oldCreator,newCreator,reason})).message)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET UNCLAIMING SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -35,7 +35,8 @@ export async function registerActions(){
|
||||
ticket.get("opendiscord:category-mode").value = categoryResult.newCategoryMode
|
||||
ticket.get("opendiscord:category").value = categoryResult.newCategoryId
|
||||
}catch(err){
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-unclaim",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-category").build("ticket-unclaim",{guild,channel,user,originalCategory:originalCategoryName,newCategory:newCategoryName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
opendiscord.log("Unable to move ticket to unclaimed category.","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
@@ -45,21 +46,8 @@ export async function registerActions(){
|
||||
}
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket unclaiming!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET UNPINNING SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -36,25 +36,13 @@ export async function registerActions(){
|
||||
{key:"oldName",value:originalName},
|
||||
{key:"newName",value:newName}
|
||||
])
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-unpin",{guild,channel,user,originalName,newName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-unpin",{guild,channel,user,originalName,newName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
}
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on ticket unpinning!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
|
||||
//reply with new message
|
||||
if (params.sendMessage){
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET TOPIC SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
@@ -34,7 +34,8 @@ export async function registerActions(){
|
||||
{key:"oldName",value:originalName},
|
||||
{key:"newName",value:newName}
|
||||
])
|
||||
await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-priority",{guild,channel,user,originalName,newName})).message)
|
||||
const sentMsg = await channel.send((await opendiscord.builders.messages.getSafe("opendiscord:error-channel-rename").build("ticket-priority",{guild,channel,user,originalName,newName})).message)
|
||||
setTimeout(() => {if (sentMsg.deletable) sentMsg.delete()},7000) //autodelete error message
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET TOPIC SYSTEM
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
///////////////////////////////////////
|
||||
//ACTION UTILITY FUNCTIONS
|
||||
//OPEN TICKET UTILITY FUNCTIONS
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
|
||||
const lang = opendiscord.languages
|
||||
|
||||
/**Fetch the interactive message state. If not present, auto replies with error and returns `null`. When `null` is received, the worker should be returned and canceled. */
|
||||
export async function replyInteractiveMessageState(instance:api.ODButtonResponderInstance|api.ODDropdownResponderInstance|api.ODModalResponderInstance,origin:"slash"|"text"|"button"|"dropdown"|"modal"|"other",channel:discord.TextBasedChannel,message:discord.Message|null,replacementCommandName:string){
|
||||
//check message state
|
||||
@@ -140,6 +138,7 @@ export async function replyMessageMustBeSentBeforeClose(instance:api.ODButtonRes
|
||||
//return when not allowed because of missing messages
|
||||
const {user,member,channel,guild} = instance
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
const permsResult = await opendiscord.permissions.checkCommandPerms(generalConfig.data.system.permissions[commandName],"support",user,member,channel,guild)
|
||||
|
||||
if (!permsResult.hasPerms) throw new api.ODSystemError("Please check permissions before using replyMessageMustBeSentBeforeClose()")
|
||||
@@ -157,4 +156,21 @@ export async function replyMessageMustBeSentBeforeClose(instance:api.ODButtonRes
|
||||
}
|
||||
return true
|
||||
}else return true
|
||||
}
|
||||
|
||||
/**Update the ticket message from a given ticket channel. This should be used after every change to the `ODTicket` after an action. */
|
||||
export async function updateTicketMessage(guild:discord.Guild,channel:discord.TextBasedChannel,user:discord.User,ticket:api.ODTicket){
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (!ticketMessage || !user || !channel || !guild || channel.isDMBased()) return
|
||||
try{
|
||||
await ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
@@ -338,8 +338,8 @@ const errorEmbeds = () => {
|
||||
instance.setDescription(lang.getTranslation("errors.descriptions.channelRename"))
|
||||
instance.setFooter(lang.getTranslationWithParams("errors.descriptions.channelRenameSource",[method]))
|
||||
instance.addFields(
|
||||
{name:lang.getTranslation("params.uppercase.originalName")+":",value:"```#"+originalName+"```",inline:false},
|
||||
{name:lang.getTranslation("params.uppercase.newName")+":",value:"```#"+newName+"```",inline:false}
|
||||
{name:lang.getTranslation("params.uppercase.originalName")+":",value:"```#"+originalName+"```",inline:true},
|
||||
{name:lang.getTranslation("params.uppercase.newName")+":",value:"```#"+newName+"```",inline:true}
|
||||
)
|
||||
})
|
||||
)
|
||||
@@ -361,9 +361,9 @@ const errorEmbeds = () => {
|
||||
instance.setFooter(lang.getTranslationWithParams("errors.descriptions.channelRenameSource",[method]))
|
||||
instance.addFields(
|
||||
//TODO TRANSLATION!!!
|
||||
{name:"Original Category"+":",value:"```"+originalCategory+"```",inline:false},
|
||||
{name:"Original Category"+":",value:"```"+originalCategory+"```",inline:true},
|
||||
//TODO TRANSLATION!!!
|
||||
{name:"New Category"+":",value:"```"+newCategory+"```",inline:false}
|
||||
{name:"New Category"+":",value:"```"+newCategory+"```",inline:true}
|
||||
)
|
||||
})
|
||||
)
|
||||
|
||||
+5
-6
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//ADD COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,16 +14,16 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"add")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"add")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch data
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//AUTOCLOSE COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,19 +14,19 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"autoclose")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"autoclose")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketOpen = await actionUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
const isTicketOpen = await openticketUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
if (!isTicketOpen) return cancel()
|
||||
|
||||
//subcommands
|
||||
@@ -48,21 +47,8 @@ export async function registerCommandResponders(){
|
||||
await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:autoclose-enable").build(origin,{guild,channel,user,ticket,reason,time}))
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on autoclose "+scope+"!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
}),
|
||||
new api.ODWorker("opendiscord:logs",-1,(instance,params,origin,cancel) => {
|
||||
const scope = instance.options.getSubCommand()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//AUTODELETE COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,16 +14,16 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"autodelete")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"autodelete")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//subcommands
|
||||
@@ -45,21 +44,8 @@ export async function registerCommandResponders(){
|
||||
await instance.reply(await opendiscord.builders.messages.getSafe("opendiscord:autodelete-enable").build(origin,{guild,channel,user,ticket,reason,time}))
|
||||
}
|
||||
|
||||
//update ticket message
|
||||
const ticketMessage = await opendiscord.tickets.getTicketMessage(ticket)
|
||||
if (ticketMessage){
|
||||
try{
|
||||
ticketMessage.edit((await opendiscord.builders.messages.getSafe("opendiscord:ticket-message").build("other",{guild,channel,user,ticket})).message)
|
||||
}catch(e){
|
||||
opendiscord.log("Unable to edit ticket message on autodelete "+scope+"!","error",[
|
||||
{key:"channel",value:"#"+channel.name},
|
||||
{key:"channelid",value:channel.id,hidden:true},
|
||||
{key:"messageid",value:ticketMessage.id},
|
||||
{key:"option",value:ticket.option.id.value}
|
||||
])
|
||||
opendiscord.debugfile.writeErrorMessage(new api.ODError(e,"uncaughtException"))
|
||||
}
|
||||
}
|
||||
//update ticket message (no await)
|
||||
openticketUtils.updateTicketMessage(guild,channel,user,ticket)
|
||||
}),
|
||||
new api.ODWorker("opendiscord:logs",-1,(instance,params,origin,cancel) => {
|
||||
const scope = instance.options.getSubCommand()
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//BLACKLIST COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
|
||||
+24
-25
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//CLAIM COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
@@ -17,19 +16,19 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"claim")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"claim")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketUnclaimed = await actionUtils.replyTicketMustBeUnclaimed(instance,origin,ticket)
|
||||
const isTicketUnclaimed = await openticketUtils.replyTicketMustBeUnclaimed(instance,origin,ticket)
|
||||
if (!isTicketUnclaimed) return cancel()
|
||||
|
||||
//start claiming ticket
|
||||
@@ -66,22 +65,22 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,user,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"claim")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"claim")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/claim")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/claim")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketUnclaimed = await actionUtils.replyTicketMustBeUnclaimed(instance,origin,ticket)
|
||||
const isTicketUnclaimed = await openticketUtils.replyTicketMustBeUnclaimed(instance,origin,ticket)
|
||||
if (!isTicketUnclaimed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -116,22 +115,22 @@ export async function registerVerifyBars(){
|
||||
const {user,member,channel,guild,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"claim")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"claim")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/claim")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/claim")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketUnclaimed = await actionUtils.replyTicketMustBeUnclaimed(instance,origin,ticket)
|
||||
const isTicketUnclaimed = await openticketUtils.replyTicketMustBeUnclaimed(instance,origin,ticket)
|
||||
if (!isTicketUnclaimed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -189,22 +188,22 @@ export async function registerModalResponders(){
|
||||
const message = await opendiscord.client.fetchChannelMessage(match[1],match[2])
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"claim")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"claim")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/claim")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/claim")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketUnclaimed = await actionUtils.replyTicketMustBeUnclaimed(instance,origin,ticket)
|
||||
const isTicketUnclaimed = await openticketUtils.replyTicketMustBeUnclaimed(instance,origin,ticket)
|
||||
if (!isTicketUnclaimed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//CLEAR COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const clearMsgState = opendiscord.states.get("opendiscord:clear-message")
|
||||
@@ -17,10 +16,10 @@ export async function registerCommandResponders(){
|
||||
|
||||
//responder checks
|
||||
//check permissions (only allow global admins: ticket admins aren't allowed to clear tickets)
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"clear",{allowChannelUserScope:false,allowChannelRoleScope:false})
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"clear",{allowChannelUserScope:false,allowChannelRoleScope:false})
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
//fetch data
|
||||
@@ -79,10 +78,10 @@ export async function registerButtonResponders(){
|
||||
}
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"clear")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"clear")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
//fetch state details
|
||||
|
||||
+27
-28
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//CLOSE COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
@@ -17,22 +16,22 @@ export async function registerCommandResponders(){
|
||||
const {user,member,channel,guild} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"close")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"close")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketOpen = await actionUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
const isTicketOpen = await openticketUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
if (!isTicketOpen) return cancel()
|
||||
|
||||
const messagesHaveBeenSent = await actionUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"close")
|
||||
const messagesHaveBeenSent = await openticketUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"close")
|
||||
if (!messagesHaveBeenSent) return cancel()
|
||||
|
||||
//start closing ticket
|
||||
@@ -68,25 +67,25 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,message,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"close")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"close")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/close")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/close")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketOpen = await actionUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
const isTicketOpen = await openticketUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
if (!isTicketOpen) return cancel()
|
||||
|
||||
const messagesHaveBeenSent = await actionUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"close")
|
||||
const messagesHaveBeenSent = await openticketUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"close")
|
||||
if (!messagesHaveBeenSent) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -121,25 +120,25 @@ export async function registerVerifyBars(){
|
||||
const {user,member,channel,guild,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"close")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"close")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/close")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/close")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketOpen = await actionUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
const isTicketOpen = await openticketUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
if (!isTicketOpen) return cancel()
|
||||
|
||||
const messagesHaveBeenSent = await actionUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"close")
|
||||
const messagesHaveBeenSent = await openticketUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"close")
|
||||
if (!messagesHaveBeenSent) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -197,22 +196,22 @@ export async function registerModalResponders(){
|
||||
const message = await opendiscord.client.fetchChannelMessage(match[1],match[2])
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"close")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"close")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/close")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/close")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketOpen = await actionUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
const isTicketOpen = await openticketUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
if (!isTicketOpen) return cancel()
|
||||
|
||||
//fetch state details
|
||||
|
||||
+24
-25
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//DELETE COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
@@ -17,22 +16,22 @@ export async function registerCommandResponders(){
|
||||
const {user,member,channel,guild} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"delete")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"delete")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketOpen = await actionUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
const isTicketOpen = await openticketUtils.replyTicketMustBeOpen(instance,origin,ticket)
|
||||
if (!isTicketOpen) return cancel()
|
||||
|
||||
const messagesHaveBeenSent = await actionUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"delete")
|
||||
const messagesHaveBeenSent = await openticketUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"delete")
|
||||
if (!messagesHaveBeenSent) return cancel()
|
||||
|
||||
//don't allow deleteWithoutTranscript to non-global-admins when enabled
|
||||
@@ -69,22 +68,22 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,message,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"delete")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"delete")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/delete")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/delete")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const messagesHaveBeenSent = await actionUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"delete")
|
||||
const messagesHaveBeenSent = await openticketUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"delete")
|
||||
if (!messagesHaveBeenSent) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -127,22 +126,22 @@ export async function registerVerifyBars(){
|
||||
const {user,member,channel,guild,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"delete")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"delete")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/delete")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/delete")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const messagesHaveBeenSent = await actionUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"delete")
|
||||
const messagesHaveBeenSent = await openticketUtils.replyMessageMustBeSentBeforeClose(instance,origin,ticket,"delete")
|
||||
if (!messagesHaveBeenSent) return cancel()
|
||||
|
||||
//don't allow deleteWithoutTranscript to non-global-admins when enabled
|
||||
@@ -222,19 +221,19 @@ export async function registerModalResponders(){
|
||||
const message = await opendiscord.client.fetchChannelMessage(match[1],match[2])
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"delete")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"delete")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/delete")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/delete")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch state details
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//HELP COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,7 +14,7 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"help")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"help")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
//calculate slash/text mode for help menu
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//MOVE COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,16 +14,16 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"move")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"move")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch data
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//STATS COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,16 +14,16 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"panel")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"panel")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch data
|
||||
|
||||
+24
-25
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//PIN COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
@@ -17,19 +16,19 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"pin")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"pin")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketUnpinned = await actionUtils.replyTicketMustBeUnpinned(instance,origin,ticket)
|
||||
const isTicketUnpinned = await openticketUtils.replyTicketMustBeUnpinned(instance,origin,ticket)
|
||||
if (!isTicketUnpinned) return cancel()
|
||||
|
||||
//start pinning ticket
|
||||
@@ -65,22 +64,22 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,user,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"pin")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"pin")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/pin")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/pin")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketUnpinned = await actionUtils.replyTicketMustBeUnpinned(instance,origin,ticket)
|
||||
const isTicketUnpinned = await openticketUtils.replyTicketMustBeUnpinned(instance,origin,ticket)
|
||||
if (!isTicketUnpinned) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -116,22 +115,22 @@ export async function registerVerifyBars(){
|
||||
const {user,member,channel,guild,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"pin")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"pin")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/pin")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/pin")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketUnpinned = await actionUtils.replyTicketMustBeUnpinned(instance,origin,ticket)
|
||||
const isTicketUnpinned = await openticketUtils.replyTicketMustBeUnpinned(instance,origin,ticket)
|
||||
if (!isTicketUnpinned) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -189,22 +188,22 @@ export async function registerModalResponders(){
|
||||
const message = await opendiscord.client.fetchChannelMessage(match[1],match[2])
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"pin")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"pin")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/pin")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/pin")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketUnpinned = await actionUtils.replyTicketMustBeUnpinned(instance,origin,ticket)
|
||||
const isTicketUnpinned = await openticketUtils.replyTicketMustBeUnpinned(instance,origin,ticket)
|
||||
if (!isTicketUnpinned) return cancel()
|
||||
|
||||
//fetch state details
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//PRIORITY COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,16 +14,16 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"priority")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"priority")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//subcommands
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//REMOVE COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,16 +14,16 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"remove")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"remove")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch data
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//RENAME COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,16 +14,16 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"rename")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"rename")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch data
|
||||
|
||||
+24
-25
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//REOPEN COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
@@ -17,19 +16,19 @@ export async function registerCommandResponders(){
|
||||
const {guild,channel,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"reopen")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"reopen")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketClosed = await actionUtils.replyTicketMustBeClosed(instance,origin,ticket)
|
||||
const isTicketClosed = await openticketUtils.replyTicketMustBeClosed(instance,origin,ticket)
|
||||
if (!isTicketClosed) return cancel()
|
||||
|
||||
//start reopening ticket
|
||||
@@ -65,22 +64,22 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,message,user,member} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"reopen")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"reopen")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/reopen")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/reopen")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketClosed = await actionUtils.replyTicketMustBeClosed(instance,origin,ticket)
|
||||
const isTicketClosed = await openticketUtils.replyTicketMustBeClosed(instance,origin,ticket)
|
||||
if (!isTicketClosed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -119,22 +118,22 @@ export async function registerVerifyBars(){
|
||||
const {user,member,channel,guild,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"reopen")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"reopen")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/reopen")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/reopen")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketClosed = await actionUtils.replyTicketMustBeClosed(instance,origin,ticket)
|
||||
const isTicketClosed = await openticketUtils.replyTicketMustBeClosed(instance,origin,ticket)
|
||||
if (!isTicketClosed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -205,22 +204,22 @@ export async function registerModalResponders(){
|
||||
const message = await opendiscord.client.fetchChannelMessage(match[1],match[2])
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"reopen")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"reopen")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/reopen")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/reopen")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketClosed = await actionUtils.replyTicketMustBeClosed(instance,origin,ticket)
|
||||
const isTicketClosed = await openticketUtils.replyTicketMustBeClosed(instance,origin,ticket)
|
||||
if (!isTicketClosed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//ROLE BUTTON (not command)
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,7 +14,7 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,user} = instance
|
||||
|
||||
//responder checks
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
//get option data
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//STATS COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -21,12 +20,12 @@ export async function registerCommandResponders(){
|
||||
return cancel()
|
||||
}else{
|
||||
//default permissions check
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"stats")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"stats")
|
||||
if (!hasPerms) return cancel()
|
||||
}
|
||||
|
||||
//responder checks
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
//subcommands
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//TICKET COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
@@ -34,10 +33,10 @@ export async function registerCommandResponders(){
|
||||
const {user,member,channel,guild} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"ticket")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"ticket")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
//get option data
|
||||
@@ -86,7 +85,7 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,user} = instance
|
||||
|
||||
//responder checks
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
//get option data
|
||||
@@ -128,7 +127,7 @@ export async function registerDropdownResponders(){
|
||||
const {guild,channel,user} = instance
|
||||
|
||||
//responder checks
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
//get option data
|
||||
@@ -178,7 +177,7 @@ export async function registerModalResponders(){
|
||||
const {guild,channel,user} = instance
|
||||
|
||||
//responder checks
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
//get option data
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//TOPIC COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -14,16 +13,16 @@ export async function registerCommandResponders(){
|
||||
new api.ODWorker("opendiscord:topic",0,async (instance,params,origin,cancel) => {
|
||||
const {user,member,channel,guild} = instance
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"topic")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"topic")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//subcommands
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//TRANSFER COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
|
||||
@@ -15,16 +14,16 @@ export async function registerCommandResponders(){
|
||||
const {user,member,channel,guild} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"transfer")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"transfer")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
//fetch data
|
||||
|
||||
+24
-25
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//UNCLAIM COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
@@ -17,19 +16,19 @@ export async function registerCommandResponders(){
|
||||
const {user,member,channel,guild} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"unclaim")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"unclaim")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketClaimed = await actionUtils.replyTicketMustBeClaimed(instance,origin,ticket)
|
||||
const isTicketClaimed = await openticketUtils.replyTicketMustBeClaimed(instance,origin,ticket)
|
||||
if (!isTicketClaimed) return cancel()
|
||||
|
||||
//start unclaiming ticket
|
||||
@@ -65,22 +64,22 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,user,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"unclaim")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"unclaim")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unclaim")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unclaim")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketClaimed = await actionUtils.replyTicketMustBeClaimed(instance,origin,ticket)
|
||||
const isTicketClaimed = await openticketUtils.replyTicketMustBeClaimed(instance,origin,ticket)
|
||||
if (!isTicketClaimed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -115,22 +114,22 @@ export async function registerVerifyBars(){
|
||||
const {user,member,channel,guild,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"unclaim")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"unclaim")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unclaim")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unclaim")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketClaimed = await actionUtils.replyTicketMustBeClaimed(instance,origin,ticket)
|
||||
const isTicketClaimed = await openticketUtils.replyTicketMustBeClaimed(instance,origin,ticket)
|
||||
if (!isTicketClaimed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -188,22 +187,22 @@ export async function registerModalResponders(){
|
||||
const message = await opendiscord.client.fetchChannelMessage(match[1],match[2])
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"unclaim")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"unclaim")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unclaim")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unclaim")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketClaimed = await actionUtils.replyTicketMustBeClaimed(instance,origin,ticket)
|
||||
const isTicketClaimed = await openticketUtils.replyTicketMustBeClaimed(instance,origin,ticket)
|
||||
if (!isTicketClaimed) return cancel()
|
||||
|
||||
//fetch state details
|
||||
|
||||
+24
-25
@@ -1,9 +1,8 @@
|
||||
///////////////////////////////////////
|
||||
//UNPIN COMMAND
|
||||
///////////////////////////////////////
|
||||
import {opendiscord, api, utilities} from "../index.js"
|
||||
import {opendiscord, api, utilities, openticketUtils} from "../index.js"
|
||||
import * as discord from "discord.js"
|
||||
import * as actionUtils from "../actions/utilities.js"
|
||||
|
||||
const generalConfig = opendiscord.configs.get("opendiscord:general")
|
||||
const lang = opendiscord.languages
|
||||
@@ -17,19 +16,19 @@ export async function registerCommandResponders(){
|
||||
const {user,member,channel,guild} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"unpin")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"unpin")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketPinned = await actionUtils.replyTicketMustBePinned(instance,origin,ticket)
|
||||
const isTicketPinned = await openticketUtils.replyTicketMustBePinned(instance,origin,ticket)
|
||||
if (!isTicketPinned) return cancel()
|
||||
|
||||
//start unpining ticket
|
||||
@@ -65,22 +64,22 @@ export async function registerButtonResponders(){
|
||||
const {guild,channel,user,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"unpin")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"unpin")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unpin")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unpin")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketPinned = await actionUtils.replyTicketMustBePinned(instance,origin,ticket)
|
||||
const isTicketPinned = await openticketUtils.replyTicketMustBePinned(instance,origin,ticket)
|
||||
if (!isTicketPinned) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -115,22 +114,22 @@ export async function registerVerifyBars(){
|
||||
const {user,member,channel,guild,message} = instance
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"unpin")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"unpin")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unpin")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unpin")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketPinned = await actionUtils.replyTicketMustBePinned(instance,origin,ticket)
|
||||
const isTicketPinned = await openticketUtils.replyTicketMustBePinned(instance,origin,ticket)
|
||||
if (!isTicketPinned) return cancel()
|
||||
|
||||
//fetch state details
|
||||
@@ -188,22 +187,22 @@ export async function registerModalResponders(){
|
||||
const message = await opendiscord.client.fetchChannelMessage(match[1],match[2])
|
||||
|
||||
//responder checks
|
||||
const hasPerms = await actionUtils.replyHasPermissions(instance,origin,"unpin")
|
||||
const hasPerms = await openticketUtils.replyHasPermissions(instance,origin,"unpin")
|
||||
if (!hasPerms) return cancel()
|
||||
|
||||
const isInGuild = await actionUtils.replyIsInGuild(instance,origin)
|
||||
const isInGuild = await openticketUtils.replyIsInGuild(instance,origin)
|
||||
if (!isInGuild || !guild || !channel || channel.isDMBased()) return cancel()
|
||||
|
||||
const state = await actionUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unpin")
|
||||
const state = await openticketUtils.replyInteractiveMessageState(instance,origin,channel,message,"/unpin")
|
||||
if (!state) return cancel()
|
||||
|
||||
const ticket = await actionUtils.replyIsTicket(instance,origin)
|
||||
const ticket = await openticketUtils.replyIsTicket(instance,origin)
|
||||
if (!ticket) return cancel()
|
||||
|
||||
const isAvailable = await actionUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
const isAvailable = await openticketUtils.replyTicketIsAvailable(instance,origin,ticket)
|
||||
if (!isAvailable) return cancel()
|
||||
|
||||
const isTicketPinned = await actionUtils.replyTicketMustBePinned(instance,origin,ticket)
|
||||
const isTicketPinned = await openticketUtils.replyTicketMustBePinned(instance,origin,ticket)
|
||||
if (!isTicketPinned) return cancel()
|
||||
|
||||
//fetch state details
|
||||
|
||||
@@ -54,6 +54,7 @@ utilities.moduleInstalled("typescript",true)
|
||||
utilities.moduleInstalled("terminal-kit",true)
|
||||
|
||||
export const opendiscord: api.ODOpenTicketMain = new api.ODOpenTicketMain()
|
||||
export * as openticketUtils from "./actions/utilities.js"
|
||||
|
||||
utilities.initialStartupLogs(opendiscord,"openticket")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user