Add new /transfer (ownership) command

This commit is contained in:
Isaac 2022-10-16 14:11:40 +01:00
parent 5b95610338
commit 9b0a1fe50f
No known key found for this signature in database
GPG Key ID: 0DE40AE37BBA5C33
2 changed files with 62 additions and 9 deletions

View File

@ -0,0 +1,46 @@
const { SlashCommand } = require('@eartharoid/dbf');
const { ApplicationCommandOptionType } = require('discord.js');
module.exports = class TransferSlashCommand extends SlashCommand {
constructor(client, options) {
const descriptionLocalizations = {};
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.transfer.description')));
const nameLocalizations = {};
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, 'commands.slash.transfer.name')));
let opts = [
{
name: 'member',
required: true,
type: ApplicationCommandOptionType.User,
},
];
opts = opts.map(o => {
const descriptionLocalizations = {};
client.i18n.locales.forEach(l => (descriptionLocalizations[l] = client.i18n.getMessage(l, `commands.slash.transfer.options.${o.name}.description`)));
const nameLocalizations = {};
client.i18n.locales.forEach(l => (nameLocalizations[l] = client.i18n.getMessage(l, `commands.slash.transfer.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) {}
};

View File

@ -106,6 +106,13 @@ commands:
support: Support support: Support
settings: Bot settings settings: Bot settings
title: Help title: Help
move:
description: move a ticket to another category
name: move
options:
category:
description: The category to move the ticket to
name: category
new: new:
description: Create a new ticket description: Create a new ticket
name: new name: new
@ -167,13 +174,13 @@ commands:
ticket: ticket:
description: The number of the ticket to get the transcript of description: The number of the ticket to get the transcript of
name: ticket name: ticket
move: transfer:
description: move a ticket to another category description: Transfer ownership of a ticket to another member
name: move name: transfer
options: options:
category: member:
description: The category to move the ticket to description: The member to transfer ownership to
name: category name: member
user: user:
create: create:
name: Create a ticket for user name: Create a ticket for user
@ -239,6 +246,9 @@ misc:
description: You didn't respond in time. Please try again. description: You didn't respond in time. Please try again.
title: ⏰ Expired title: ⏰ Expired
expires_in: Expires in {time} expires_in: Expires in {time}
invalid_ticket:
description: Please specify a valid ticket.
title: ❌ Invalid ticket
member_limit: member_limit:
description: description:
- Please use your existing ticket or close it before creating another. - Please use your existing ticket or close it before creating another.
@ -259,9 +269,6 @@ misc:
not_ticket: not_ticket:
description: You can only use this command in tickets. description: You can only use this command in tickets.
title: ❌ This isn't a ticket channel title: ❌ This isn't a ticket channel
invalid_ticket:
description: Please specify a valid ticket.
title: ❌ Invalid ticket
ratelimited: ratelimited:
description: Try again in a few seconds. description: Try again in a few seconds.
title: 🐢 Please slow down title: 🐢 Please slow down