Cgx
Cgx
DIAdiscord.js - Imagine a bot
Created by Cgx on 10/28/2023 in #djs-questions
permission | bitfield invalid
Perfect, thanks!
4 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 9/4/2023 in #djs-questions
Permission system not working
No description
26 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 9/4/2023 in #djs-questions
Permission system not working
that seemed to work! Well now i got another error....
26 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 9/4/2023 in #djs-questions
Permission system not working
uhm oh... Well what can i use instead of it?
26 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 9/4/2023 in #djs-questions
Permission system not working
nope, in a server
26 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 9/4/2023 in #djs-questions
Permission system not working
No description
26 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 9/4/2023 in #djs-questions
Permission system not working
const { SlashCommandBuilder } = require("@discordjs/builders");
const { Permissions } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName("steal")
.setDescription("Add an emoji to the server")
.addStringOption((option) =>
option
.setName("emoji")
.setDescription("The emoji to add to the server")
.setRequired(true),
)
.setDMPermission(false),

async execute(interaction) {
const { options, member } = interaction;
const emoji = options.getString("emoji");

if (!emoji) {
return interaction.reply(
"No emoji provided. Please provide a valid Discord emoji."
);
}

const match = emoji.match(/^<a?:\w+:(\d+)>$/);
if (!match) {
return interaction.reply(
"Invalid emoji provided. Please provide a valid Discord emoji."
);
}

const emojiID = match[1];
const isAnimated = emoji.startsWith("<a:");

if (!member.permissionsIn(interaction.guildId).has("MANAGE_EMOJIS")) {
return interaction.reply(
"You don't have permission to manage emojis in this server."
);
}

try {
const response = await fetch(
`https://cdn.discordapp.com/emojis/${emojiID}.${
isAnimated ? "gif" : "png"
}`
);
const emojiBuffer = await response.buffer();

await interaction.guild.emojis.create({
name: emoji.split(":")[1],
image: { source: emojiBuffer },
reason: `Emoji added by ${interaction.user.tag}`,
});

interaction.reply(`Emoji ${emoji} has been added to the server!`);
} catch (error) {
console.error(error);
interaction.reply(
"An error occurred while adding the emoji to the server."
);
}
},
};
const { SlashCommandBuilder } = require("@discordjs/builders");
const { Permissions } = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName("steal")
.setDescription("Add an emoji to the server")
.addStringOption((option) =>
option
.setName("emoji")
.setDescription("The emoji to add to the server")
.setRequired(true),
)
.setDMPermission(false),

async execute(interaction) {
const { options, member } = interaction;
const emoji = options.getString("emoji");

if (!emoji) {
return interaction.reply(
"No emoji provided. Please provide a valid Discord emoji."
);
}

const match = emoji.match(/^<a?:\w+:(\d+)>$/);
if (!match) {
return interaction.reply(
"Invalid emoji provided. Please provide a valid Discord emoji."
);
}

const emojiID = match[1];
const isAnimated = emoji.startsWith("<a:");

if (!member.permissionsIn(interaction.guildId).has("MANAGE_EMOJIS")) {
return interaction.reply(
"You don't have permission to manage emojis in this server."
);
}

try {
const response = await fetch(
`https://cdn.discordapp.com/emojis/${emojiID}.${
isAnimated ? "gif" : "png"
}`
);
const emojiBuffer = await response.buffer();

await interaction.guild.emojis.create({
name: emoji.split(":")[1],
image: { source: emojiBuffer },
reason: `Emoji added by ${interaction.user.tag}`,
});

interaction.reply(`Emoji ${emoji} has been added to the server!`);
} catch (error) {
console.error(error);
interaction.reply(
"An error occurred while adding the emoji to the server."
);
}
},
};
26 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 9/4/2023 in #djs-questions
Permission system not working
Well, now i got an other error.
\node_modules\discord.js\src\structures\GuildMember.js:322
if (!channel) throw new DiscordjsError(ErrorCodes.GuildChannelResolve);
^

Error [GuildChannelResolve]: Could not resolve channel to a guild channel.
\node_modules\discord.js\src\structures\GuildMember.js:322
if (!channel) throw new DiscordjsError(ErrorCodes.GuildChannelResolve);
^

Error [GuildChannelResolve]: Could not resolve channel to a guild channel.
26 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 9/4/2023 in #djs-questions
Permission system not working
ehm ups... Well, how to do it in the v14 then?
26 replies
DIAdiscord.js - Imagine a bot
Created by InspectorGadget on 7/25/2023 in #djs-questions
Discord Slash Embed Message
I strongly recommend to use EmbedBuilder since it's way easier to use. Since you use it as Object, you need to use
timestamp: new Date().toISOString(),
timestamp: new Date().toISOString(),
11 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/24/2023 in #djs-questions
Cannot read properties of null (reading 'id')
Well, that resolved it, thanks
15 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/24/2023 in #djs-questions
Cannot read properties of null (reading 'id')
Uhm... cgx.exe stopped working
15 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/24/2023 in #djs-questions
Cannot read properties of null (reading 'id')
I guess I have to beg discord to give me the guilds intent since I only got the message content intent
15 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/24/2023 in #djs-questions
Cannot read properties of null (reading 'id')
Oh, seems to be this the error...
15 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/24/2023 in #djs-questions
Cannot read properties of null (reading 'id')
Nope, in the server
15 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/24/2023 in #djs-questions
Cannot read properties of null (reading 'id')
still the same
15 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/24/2023 in #djs-questions
Cannot read properties of null (reading 'id')
yes
15 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/24/2023 in #djs-questions
Cannot read properties of null (reading 'id')
Code:
const category = interaction.options.getString('category');
const channel = interaction.channel;

const pro = new EmbedBuilder()
.setColor('#35393e')
.setTitle('<:kenon_time:1112837885696155759> 〢 Slow down!')
.setDescription(`There's still a Round in progress.`);

// Check if a round is already in progress in the channel
if (activeRounds[channel.id]) {
// Send an invisible message to inform that a round is still running
await interaction.reply({ embeds: [pro], ephemeral: true });
return;
}

// Mark the channel as having an active round
activeRounds[channel.id] = true;
const category = interaction.options.getString('category');
const channel = interaction.channel;

const pro = new EmbedBuilder()
.setColor('#35393e')
.setTitle('<:kenon_time:1112837885696155759> 〢 Slow down!')
.setDescription(`There's still a Round in progress.`);

// Check if a round is already in progress in the channel
if (activeRounds[channel.id]) {
// Send an invisible message to inform that a round is still running
await interaction.reply({ embeds: [pro], ephemeral: true });
return;
}

// Mark the channel as having an active round
activeRounds[channel.id] = true;
If more is needed to help, please ping me
15 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/22/2023 in #djs-questions
channel.isTextBased() is not a function
<a:wwe_pepe_heli:1109129134841528350>
13 replies
DIAdiscord.js - Imagine a bot
Created by Cgx on 7/22/2023 in #djs-questions
channel.isTextBased() is not a function
Thank you anyways
13 replies