From e28392352c0f12a2f1b87f4e4f3db162d80127af Mon Sep 17 00:00:00 2001 From: Isaac Date: Tue, 2 Aug 2022 18:03:55 +0100 Subject: [PATCH] Add autocomplete, button, menu, and modal files --- package.json | 2 +- src/autocomplete/tag.js | 12 ++++++++++++ src/buttons/claim.js | 12 ++++++++++++ src/buttons/close.js | 12 ++++++++++++ src/buttons/create.js | 12 ++++++++++++ src/buttons/unclaim.js | 12 ++++++++++++ src/i18n/en-GB.yml | 2 +- src/menus/create.js | 12 ++++++++++++ src/modals/feedback.js | 12 ++++++++++++ src/modals/questions.js | 12 ++++++++++++ src/routes/api/admin/guilds/[guild]/panels.js | 8 ++++---- 11 files changed, 102 insertions(+), 6 deletions(-) create mode 100644 src/autocomplete/tag.js create mode 100644 src/buttons/claim.js create mode 100644 src/buttons/close.js create mode 100644 src/buttons/create.js create mode 100644 src/buttons/unclaim.js create mode 100644 src/menus/create.js create mode 100644 src/modals/feedback.js create mode 100644 src/modals/questions.js diff --git a/package.json b/package.json index 2baa031..612aa58 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "node": ">=18.0" }, "dependencies": { - "@eartharoid/dbf": "^0.3.0", + "@eartharoid/dbf": "^0.3.1", "@eartharoid/dtf": "^2.0.1", "@eartharoid/i18n": "^1.0.4", "@fastify/cookie": "^6.0.0", diff --git a/src/autocomplete/tag.js b/src/autocomplete/tag.js new file mode 100644 index 0000000..126bd78 --- /dev/null +++ b/src/autocomplete/tag.js @@ -0,0 +1,12 @@ +const { Autocompleter } = require('@eartharoid/dbf'); + +module.exports = class TagCompleter extends Autocompleter { + constructor(client, options) { + super(client, { + ...options, + id: 'tag', + }); + } + + async run(value, comamnd, interaction) { } +}; \ No newline at end of file diff --git a/src/buttons/claim.js b/src/buttons/claim.js new file mode 100644 index 0000000..2461e4b --- /dev/null +++ b/src/buttons/claim.js @@ -0,0 +1,12 @@ +const { Button } = require('@eartharoid/dbf'); + +module.exports = class ClaimButton extends Button { + constructor(client, options) { + super(client, { + ...options, + id: 'claim', + }); + } + + async run (id, interaction) {} +}; \ No newline at end of file diff --git a/src/buttons/close.js b/src/buttons/close.js new file mode 100644 index 0000000..bd7b151 --- /dev/null +++ b/src/buttons/close.js @@ -0,0 +1,12 @@ +const { Button } = require('@eartharoid/dbf'); + +module.exports = class CloseButton extends Button { + constructor(client, options) { + super(client, { + ...options, + id: 'close', + }); + } + + async run(id, interaction) { } +}; \ No newline at end of file diff --git a/src/buttons/create.js b/src/buttons/create.js new file mode 100644 index 0000000..be7a97f --- /dev/null +++ b/src/buttons/create.js @@ -0,0 +1,12 @@ +const { Button } = require('@eartharoid/dbf'); + +module.exports = class CreateButton extends Button { + constructor(client, options) { + super(client, { + ...options, + id: 'create', + }); + } + + async run(id, interaction) { } +}; \ No newline at end of file diff --git a/src/buttons/unclaim.js b/src/buttons/unclaim.js new file mode 100644 index 0000000..50ed4b5 --- /dev/null +++ b/src/buttons/unclaim.js @@ -0,0 +1,12 @@ +const { Button } = require('@eartharoid/dbf'); + +module.exports = class UnclaimButton extends Button { + constructor(client, options) { + super(client, { + ...options, + id: 'unclaim', + }); + } + + async run(id, interaction) { } +}; \ No newline at end of file diff --git a/src/i18n/en-GB.yml b/src/i18n/en-GB.yml index 5df10cb..9dedf91 100644 --- a/src/i18n/en-GB.yml +++ b/src/i18n/en-GB.yml @@ -28,5 +28,5 @@ log: update: 'updated' tickets: menus: - panel: + create: placeholder: 'Select a ticket category' \ No newline at end of file diff --git a/src/menus/create.js b/src/menus/create.js new file mode 100644 index 0000000..a0a0dfa --- /dev/null +++ b/src/menus/create.js @@ -0,0 +1,12 @@ +const { Menu } = require('@eartharoid/dbf'); + +module.exports = class CreateMenu extends Menu { + constructor(client, options) { + super(client, { + ...options, + id: 'create', + }); + } + + async run(id, interaction) { } +}; \ No newline at end of file diff --git a/src/modals/feedback.js b/src/modals/feedback.js new file mode 100644 index 0000000..74c19ac --- /dev/null +++ b/src/modals/feedback.js @@ -0,0 +1,12 @@ +const { Modal } = require('@eartharoid/dbf'); + +module.exports = class FeedbackModal extends Modal { + constructor(client, options) { + super(client, { + ...options, + id: 'feedback', + }); + } + + async run(id, interaction) { } +}; \ No newline at end of file diff --git a/src/modals/questions.js b/src/modals/questions.js new file mode 100644 index 0000000..5554551 --- /dev/null +++ b/src/modals/questions.js @@ -0,0 +1,12 @@ +const { Modal } = require('@eartharoid/dbf'); + +module.exports = class QuestionsModal extends Modal { + constructor(client, options) { + super(client, { + ...options, + id: 'questions', + }); + } + + async run(id, interaction) { } +}; \ No newline at end of file diff --git a/src/routes/api/admin/guilds/[guild]/panels.js b/src/routes/api/admin/guilds/[guild]/panels.js index 3e0a211..7b39f1a 100644 --- a/src/routes/api/admin/guilds/[guild]/panels.js +++ b/src/routes/api/admin/guilds/[guild]/panels.js @@ -77,7 +77,7 @@ module.exports.post = fastify => ({ components.push( new ButtonBuilder() .setCustomId(JSON.stringify({ - action: 'createTicket', + action: 'create', target: categories[0].id, })) .setStyle(Primary) @@ -90,7 +90,7 @@ module.exports.post = fastify => ({ ...categories.map(category => new ButtonBuilder() .setCustomId(JSON.stringify({ - action: 'createTicket', + action: 'create', target: category.id, })) .setStyle(Secondary) @@ -101,8 +101,8 @@ module.exports.post = fastify => ({ } else { components.push( new SelectMenuBuilder() - .setCustomId('createTicket') - .setPlaceholder(getMessage('menus.panel.placeholder')) + .setCustomId('create') + .setPlaceholder(getMessage('menus.create.placeholder')) .setOptions( categories.map(category => new SelectMenuOptionBuilder()