mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-11-17 17:23:08 +02:00
Create commands
This commit is contained in:
parent
e28392352c
commit
b4618aac1b
@ -10,3 +10,5 @@ SUPER=
|
|||||||
|
|
||||||
|
|
||||||
https://www.prisma.io/docs/reference/database-reference/supported-databases
|
https://www.prisma.io/docs/reference/database-reference/supported-databases
|
||||||
|
|
||||||
|
![](https://static.eartharoid.me/k/22/08/02185801.png) - for user/create and slash/force-close
|
@ -34,7 +34,7 @@
|
|||||||
"node": ">=18.0"
|
"node": ">=18.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eartharoid/dbf": "^0.3.1",
|
"@eartharoid/dbf": "^0.3.2",
|
||||||
"@eartharoid/dtf": "^2.0.1",
|
"@eartharoid/dtf": "^2.0.1",
|
||||||
"@eartharoid/i18n": "^1.0.4",
|
"@eartharoid/i18n": "^1.0.4",
|
||||||
"@fastify/cookie": "^6.0.0",
|
"@fastify/cookie": "^6.0.0",
|
||||||
|
12
src/autocomplete/references.js
Normal file
12
src/autocomplete/references.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
const { Autocompleter } = require('@eartharoid/dbf');
|
||||||
|
|
||||||
|
module.exports = class ReferencesCompleter extends Autocompleter {
|
||||||
|
constructor(client, options) {
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
id: 'references',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(value, comamnd, interaction) { }
|
||||||
|
};
|
12
src/autocomplete/ticket.js
Normal file
12
src/autocomplete/ticket.js
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
const { Autocompleter } = require('@eartharoid/dbf');
|
||||||
|
|
||||||
|
module.exports = class TicketCompleter extends Autocompleter {
|
||||||
|
constructor(client, options) {
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
id: 'ticket',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(value, comamnd, interaction) { }
|
||||||
|
};
|
17
src/commands/message/create.js
Normal file
17
src/commands/message/create.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const { MessageCommand } = require('@eartharoid/dbf');
|
||||||
|
|
||||||
|
module.exports = class CreateMessageCommand extends MessageCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.message.create.name')));
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
17
src/commands/message/pin.js
Normal file
17
src/commands/message/pin.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const { MessageCommand } = require('@eartharoid/dbf');
|
||||||
|
|
||||||
|
module.exports = class PinMessageCommand extends MessageCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.message.pin.name')));
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
51
src/commands/slash/add.js
Normal file
51
src/commands/slash/add.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class AddSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.add.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.add.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
name: 'member',
|
||||||
|
required: true,
|
||||||
|
type: ApplicationCommandOptionType.User,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ticket',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.Channel,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.add.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.add.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
61
src/commands/slash/close.js
Normal file
61
src/commands/slash/close.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class CloseSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.close.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.close.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
name: 'channel',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.Channel,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'number',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.Integer,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'reason',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.String,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'time',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.String,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.close.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.close.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
61
src/commands/slash/force-close.js
Normal file
61
src/commands/slash/force-close.js
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class ForceCloseSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.force-close.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.force-close.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
name: 'channel',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.Channel,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'number',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.Integer,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'reason',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.String,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'time',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.String,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.force-close.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.force-close.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
47
src/commands/slash/new.js
Normal file
47
src/commands/slash/new.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class NewSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.new.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.new.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
autocomplete: true,
|
||||||
|
name: 'references',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.Integer,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.new.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.new.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
59
src/commands/slash/priority.js
Normal file
59
src/commands/slash/priority.js
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class PrioritySlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.priority.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.priority.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
choices: ['HIGH', 'MEDIUM', 'LOW'],
|
||||||
|
name: 'priority',
|
||||||
|
required: true,
|
||||||
|
type: ApplicationCommandOptionType.String,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.priority.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.priority.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
if (o.choices) {
|
||||||
|
o.choices = o.choices.map(c => {
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.priority.options.${o.name}.choices.${c}`)));
|
||||||
|
return {
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
value: c,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
51
src/commands/slash/remove.js
Normal file
51
src/commands/slash/remove.js
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class RemoveSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.remove.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.remove.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
name: 'member',
|
||||||
|
required: true,
|
||||||
|
type: ApplicationCommandOptionType.User,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ticket',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.Channel,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.remove.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.remove.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
47
src/commands/slash/tag.js
Normal file
47
src/commands/slash/tag.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class TagSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.tag.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.tag.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
autocomplete: true,
|
||||||
|
name: 'tag',
|
||||||
|
required: true,
|
||||||
|
type: ApplicationCommandOptionType.String,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.tag.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.tag.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
46
src/commands/slash/tickets.js
Normal file
46
src/commands/slash/tickets.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class TicketsSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.tickets.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.tickets.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
name: 'member',
|
||||||
|
required: false,
|
||||||
|
type: ApplicationCommandOptionType.User,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.tickets.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.tickets.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
46
src/commands/slash/topic.js
Normal file
46
src/commands/slash/topic.js
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class TopicSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.topic.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.topic.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
name: 'new-topic',
|
||||||
|
required: true,
|
||||||
|
type: ApplicationCommandOptionType.String,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.topic.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.topic.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
47
src/commands/slash/transcript.js
Normal file
47
src/commands/slash/transcript.js
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
const { SlashCommand } = require('@eartharoid/dbf');
|
||||||
|
const { ApplicationCommandOptionType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = class TranscriptSlashCommand extends SlashCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.transcript.description')));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.transcript.name')));
|
||||||
|
|
||||||
|
let opts = [
|
||||||
|
{
|
||||||
|
autocomplete: true,
|
||||||
|
name: 'ticket',
|
||||||
|
required: true,
|
||||||
|
type: ApplicationCommandOptionType.Integer,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
opts = opts.map(o => {
|
||||||
|
const descriptionLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.transcript.options.${o.name}.description`)));
|
||||||
|
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.transcript.options.${o.name}.name`)));
|
||||||
|
|
||||||
|
return {
|
||||||
|
...o,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
nameLocalizations: nameLocalizations,
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
description: descriptionLocalizations['en-GB'],
|
||||||
|
descriptionLocalizations,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
options: opts,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
17
src/commands/user/create.js
Normal file
17
src/commands/user/create.js
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
const { UserCommand } = require('@eartharoid/dbf');
|
||||||
|
|
||||||
|
module.exports = class CreateUserCommand extends UserCommand {
|
||||||
|
constructor(client, options) {
|
||||||
|
const nameLocalizations = {};
|
||||||
|
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.user.create.name')));
|
||||||
|
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
dmPermission: false,
|
||||||
|
name: nameLocalizations['en-GB'],
|
||||||
|
nameLocalizations,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(interaction) { }
|
||||||
|
};
|
@ -1,32 +1,142 @@
|
|||||||
|
test: |
|
||||||
|
line 1
|
||||||
|
line 2
|
||||||
buttons:
|
buttons:
|
||||||
create:
|
create:
|
||||||
emoji: '🎫'
|
emoji: 🎫
|
||||||
text: 'Create a ticket'
|
text: Create a ticket
|
||||||
commands:
|
commands:
|
||||||
|
message:
|
||||||
|
create:
|
||||||
|
name: Create a ticket from message
|
||||||
|
pin:
|
||||||
|
name: Pin message
|
||||||
|
slash:
|
||||||
|
add:
|
||||||
|
description: Add a member to a ticket
|
||||||
|
name: add
|
||||||
|
options:
|
||||||
|
member:
|
||||||
|
description: The member to add to the ticket
|
||||||
|
name: member
|
||||||
|
ticket:
|
||||||
|
description: The ticket to add the member to
|
||||||
|
name: ticket
|
||||||
|
close:
|
||||||
|
description: Close a ticket
|
||||||
|
name: close
|
||||||
|
options:
|
||||||
|
channel:
|
||||||
|
description: The ticket channel to close
|
||||||
|
name: channel
|
||||||
|
number:
|
||||||
|
description: The number of the ticket to close
|
||||||
|
name: number
|
||||||
|
reason:
|
||||||
|
description: The reason for closing the ticket(s)
|
||||||
|
name: reason
|
||||||
|
time:
|
||||||
|
description: Close all tickets that have been inactive for the specific time
|
||||||
|
name: time
|
||||||
|
force-close:
|
||||||
|
description: Forcibly close a ticket
|
||||||
|
name: force-close
|
||||||
|
options:
|
||||||
|
channel:
|
||||||
|
description: The ticket channel to close
|
||||||
|
name: channel
|
||||||
|
number:
|
||||||
|
description: The number of the ticket to close
|
||||||
|
name: number
|
||||||
|
reason:
|
||||||
|
description: The reason for closing the ticket(s)
|
||||||
|
name: reason
|
||||||
|
time:
|
||||||
|
description: Close all tickets that have been inactive for the specific time
|
||||||
|
name: time
|
||||||
|
new:
|
||||||
|
description: Create a new ticket
|
||||||
|
name: new
|
||||||
|
options:
|
||||||
|
references:
|
||||||
|
description: The number of a related ticket
|
||||||
|
name: references
|
||||||
|
priority:
|
||||||
|
description: Set the priority of a ticket
|
||||||
|
name: priority
|
||||||
|
options:
|
||||||
|
priority:
|
||||||
|
choices:
|
||||||
|
HIGH: 🔴 High
|
||||||
|
MEDIUM: 🟠 Medium
|
||||||
|
LOW: 🟢 Low
|
||||||
|
description: The priority of the ticket
|
||||||
|
name: priority
|
||||||
|
remove:
|
||||||
|
description: Remove a member from a ticket
|
||||||
|
name: remove
|
||||||
|
options:
|
||||||
|
member:
|
||||||
|
description: The member to remove from the ticket
|
||||||
|
name: member
|
||||||
|
ticket:
|
||||||
|
description: The ticket to remove the member from
|
||||||
|
name: ticket
|
||||||
|
tag:
|
||||||
|
description: Use a tag
|
||||||
|
name: tag
|
||||||
|
options:
|
||||||
|
tag:
|
||||||
|
description: The name of the tag to use
|
||||||
|
name: tag
|
||||||
|
topic:
|
||||||
|
description: Change the topic of a ticket
|
||||||
|
name: topic
|
||||||
|
options:
|
||||||
|
new-topic:
|
||||||
|
description: The new topic of the ticket
|
||||||
|
name: new-topic
|
||||||
|
tickets:
|
||||||
|
description: List your own or someone else's tickets
|
||||||
|
name: tickets
|
||||||
|
options:
|
||||||
|
member:
|
||||||
|
description: The member to list the tickets of
|
||||||
|
name: member
|
||||||
|
transcript:
|
||||||
|
description: Get the transcript of a ticket
|
||||||
|
name: transcript
|
||||||
|
options:
|
||||||
|
ticket:
|
||||||
|
description: The number of the ticket to get the transcript of
|
||||||
|
name: ticket
|
||||||
|
user:
|
||||||
|
create:
|
||||||
|
name: Create a ticket for user
|
||||||
log:
|
log:
|
||||||
admin:
|
admin:
|
||||||
changes: 'Changes'
|
changes: Changes
|
||||||
description:
|
description:
|
||||||
joined: '{user} {verb} {targetType}'
|
joined: '{user} {verb} {targetType}'
|
||||||
target:
|
target:
|
||||||
category: 'a category'
|
category: a category
|
||||||
panel: 'a panel'
|
panel: a panel
|
||||||
question: 'a question'
|
question: a question
|
||||||
settings: 'the settings'
|
settings: the settings
|
||||||
tag: 'a tag'
|
tag: a tag
|
||||||
title:
|
title:
|
||||||
joined: '{targetType} {verb}'
|
joined: '{targetType} {verb}'
|
||||||
target:
|
target:
|
||||||
category: 'Category'
|
category: Category
|
||||||
panel: 'Panel'
|
panel: Panel
|
||||||
question: 'Question'
|
question: Question
|
||||||
settings: 'Settings'
|
settings: Settings
|
||||||
tag: 'Tag'
|
tag: Tag
|
||||||
verb:
|
verb:
|
||||||
create: 'created'
|
create: created
|
||||||
delete: 'deleted'
|
delete: deleted
|
||||||
update: 'updated'
|
update: updated
|
||||||
tickets:
|
tickets:
|
||||||
menus:
|
menus:
|
||||||
create:
|
create:
|
||||||
placeholder: 'Select a ticket category'
|
placeholder: Select a ticket category
|
21
src/listeners/commands/componentLoad.js
Normal file
21
src/listeners/commands/componentLoad.js
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
const { Listener } = require('@eartharoid/dbf');
|
||||||
|
|
||||||
|
module.exports = class extends Listener {
|
||||||
|
constructor(client, options) {
|
||||||
|
super(client, {
|
||||||
|
...options,
|
||||||
|
emitter: client.commands,
|
||||||
|
event: 'componentLoad',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
run(command) {
|
||||||
|
const types = {
|
||||||
|
1: 'slash',
|
||||||
|
2: 'user',
|
||||||
|
3: 'message',
|
||||||
|
};
|
||||||
|
this.client.log.info.commands(`Loaded "${command.name}" ${types[command.type]} command`);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user