Khalid
DIAdiscord.js - Imagine an app
•Created by Khalid on 5/17/2024 in #djs-questions
Can’t create channels
my bot was working perfectly but after a while it won’t create any more channels:
if (interaction.customId === 'ButtonID') {
await interaction.deferUpdate().catch(err => { console.log(err) });
if (openticket.has(interaction.user.id)) return interaction.followUp({ content: `<@${interaction.user.id}> You already have unclosed ticket `, ephemeral: true }).catch(err => { console.log(err) });
catagory = "CatagoryID"
interaction.guild.channels.create({
name: `🟢-Ticket`,
type: ChannelType.GuildText,
parent: catagory,
topic: "welcome, what do you need?",
permissionOverwrites: [
{
id: interaction.guild.id,
deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages]
},
{
id: interaction.user.id,
allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory, PermissionsBitField.Flags.EmbedLinks, PermissionsBitField.Flags.AttachFiles]
},
]
}).then(async t => {
interaction.followUp({ content: `Your ticket was created: <#${t.id}>`, ephemeral: true }).catch(err => { console.log(err) }); openticket.add(interaction.user.id);
t.send("test").catch(err => { console.log(err) });
}).catch(async err => {
console.log(err);
interaction.followUp({ content: `${err}`, ephemeral: true }).catch(err => { console.log(err) });
});
if (interaction.customId === 'ButtonID') {
await interaction.deferUpdate().catch(err => { console.log(err) });
if (openticket.has(interaction.user.id)) return interaction.followUp({ content: `<@${interaction.user.id}> You already have unclosed ticket `, ephemeral: true }).catch(err => { console.log(err) });
catagory = "CatagoryID"
interaction.guild.channels.create({
name: `🟢-Ticket`,
type: ChannelType.GuildText,
parent: catagory,
topic: "welcome, what do you need?",
permissionOverwrites: [
{
id: interaction.guild.id,
deny: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages]
},
{
id: interaction.user.id,
allow: [PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ReadMessageHistory, PermissionsBitField.Flags.EmbedLinks, PermissionsBitField.Flags.AttachFiles]
},
]
}).then(async t => {
interaction.followUp({ content: `Your ticket was created: <#${t.id}>`, ephemeral: true }).catch(err => { console.log(err) }); openticket.add(interaction.user.id);
t.send("test").catch(err => { console.log(err) });
}).catch(async err => {
console.log(err);
interaction.followUp({ content: `${err}`, ephemeral: true }).catch(err => { console.log(err) });
});
28 replies