54 lines
1.7 KiB
JavaScript
54 lines
1.7 KiB
JavaScript
import { ApplicationCommandOptionTypes, ApplicationCommandTypes, ButtonStyles, ComponentTypes, MessageFlags, Permissions, SeparatorSpacingSize } from "oceanic.js";
|
|
|
|
export default {
|
|
data: {
|
|
name: "reakcnerole",
|
|
},
|
|
|
|
handle: async (interaction, database) => {
|
|
await interaction.defer(MessageFlags.EPHEMERAL)
|
|
|
|
const db = database.table(`rr`)
|
|
|
|
const splitID = interaction.data.customID.split('.')
|
|
|
|
const kolekcia = splitID[1]
|
|
|
|
const exists = await db.has(`${interaction.guildID}.${kolekcia}`)
|
|
|
|
if (!exists)
|
|
return await interaction.createFollowup({
|
|
flags: MessageFlags.IS_COMPONENTS_V2,
|
|
components: [
|
|
{
|
|
type: ComponentTypes.CONTAINER,
|
|
components: [
|
|
{
|
|
type: ComponentTypes.TEXT_DISPLAY,
|
|
content: `❌ kolekcia ${kolekcia} neexistuje`
|
|
}
|
|
]
|
|
}
|
|
]
|
|
})
|
|
|
|
const popis = interaction.data.components.getTextInput(`popis`)
|
|
|
|
await db.set(`${interaction.guildID}.${kolekcia}.popis`, popis)
|
|
|
|
await interaction.createFollowup({
|
|
flags: MessageFlags.IS_COMPONENTS_V2,
|
|
components: [
|
|
{
|
|
type: ComponentTypes.CONTAINER,
|
|
components: [
|
|
{
|
|
type: ComponentTypes.TEXT_DISPLAY,
|
|
content: `✅ popis kolekcie ${kolekcia} zmeneny`
|
|
}
|
|
]
|
|
}
|
|
]
|
|
})
|
|
}
|
|
} |