Untitled
unknown
typescript
2 years ago
1.8 kB
9
Indexable
await interaction.editReply({
embeds: [embed],
components: [actionRow]
}).then(async(msg) => {
if (actionRow.components.length === 0) return;
const filter = (i: ButtonInteraction) => ['trainee', 'staff', 'admin', 'owner'].includes(i.customId) && i.user.id === interaction.user.id
const collector = msg.createMessageComponentCollector({
filter: filter,
time: 60000,
componentType: ComponentType.Button
})
collector.on('collect', async (i: ButtonInteraction) => {
let updatedActionRow = actionRow
switch(i.customId) {
case 'trainee':
const data = trainee.filter(item => item !== user?.id)
await this.container.client._keyv.set('TraineeAccess', data).then(async() => {
await i.reply({
content: `Removed \`TraineeAccess\``
})
})
break;
case 'staff':
const data1 = staff.filter(item => item !== user?.id)
await this.container.client._keyv.set('StaffAccess', data1).then(async() => {
await i.reply({
content: `Removed \`StaffAccess\``
})
})
break;
case 'admin':
const data2 = admin.filter(item => item !== user?.id)
await this.container.client._keyv.set('AdminAccess', data2).then(async() => {
await i.reply({
content: `Removed \`AdminAccess\``
})
})
break;
case 'owner':
const data3 = owner.filter(item => item !== user?.id)
await this.container.client._keyv.set('OwnerAccess', data3).then(async() => {
await i.reply({
content: `Removed \`OwnerAccess\``
})
})
break;
}Editor is loading...
Leave a Comment