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