Add autocomplete, button, menu, and modal files

This commit is contained in:
Isaac 2022-08-02 18:03:55 +01:00
parent 327573a38a
commit e28392352c
No known key found for this signature in database
GPG Key ID: F4EAABEB0FFCC06A
11 changed files with 102 additions and 6 deletions

View File

@ -34,7 +34,7 @@
"node": ">=18.0" "node": ">=18.0"
}, },
"dependencies": { "dependencies": {
"@eartharoid/dbf": "^0.3.0", "@eartharoid/dbf": "^0.3.1",
"@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/tag.js Normal file
View File

@ -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) { }
};

12
src/buttons/claim.js Normal file
View File

@ -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) {}
};

12
src/buttons/close.js Normal file
View File

@ -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) { }
};

12
src/buttons/create.js Normal file
View File

@ -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) { }
};

12
src/buttons/unclaim.js Normal file
View File

@ -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) { }
};

View File

@ -28,5 +28,5 @@ log:
update: 'updated' update: 'updated'
tickets: tickets:
menus: menus:
panel: create:
placeholder: 'Select a ticket category' placeholder: 'Select a ticket category'

12
src/menus/create.js Normal file
View File

@ -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) { }
};

12
src/modals/feedback.js Normal file
View File

@ -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) { }
};

12
src/modals/questions.js Normal file
View File

@ -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) { }
};

View File

@ -77,7 +77,7 @@ module.exports.post = fastify => ({
components.push( components.push(
new ButtonBuilder() new ButtonBuilder()
.setCustomId(JSON.stringify({ .setCustomId(JSON.stringify({
action: 'createTicket', action: 'create',
target: categories[0].id, target: categories[0].id,
})) }))
.setStyle(Primary) .setStyle(Primary)
@ -90,7 +90,7 @@ module.exports.post = fastify => ({
...categories.map(category => ...categories.map(category =>
new ButtonBuilder() new ButtonBuilder()
.setCustomId(JSON.stringify({ .setCustomId(JSON.stringify({
action: 'createTicket', action: 'create',
target: category.id, target: category.id,
})) }))
.setStyle(Secondary) .setStyle(Secondary)
@ -101,8 +101,8 @@ module.exports.post = fastify => ({
} else { } else {
components.push( components.push(
new SelectMenuBuilder() new SelectMenuBuilder()
.setCustomId('createTicket') .setCustomId('create')
.setPlaceholder(getMessage('menus.panel.placeholder')) .setPlaceholder(getMessage('menus.create.placeholder'))
.setOptions( .setOptions(
categories.map(category => categories.map(category =>
new SelectMenuOptionBuilder() new SelectMenuOptionBuilder()