SirNuny
SirNuny
DIAdiscord.js - Imagine an app
Created by SirNuny on 6/20/2024 in #djs-questions
Images randomly not loading
I have a code to log removed images. However, sometimes the image is displayed correctly, and sometimes it's just not showing in the embed. Here's my code:
for (const attachment of attachments) {
const fileType = attachment.contentType.split('/')[0];

if (fileType == 'image') {
const newAttachment = new AttachmentBuilder(attachment.url, { name: attachment.name });

const imageEmbed = new EmbedBuilder()
.setColor('ff2a2a')
.setImage(`attachment://${newAttachment.name}`)

logChannel.send({ embeds: [imageEmbed], files: [newAttachment] });
}
}
for (const attachment of attachments) {
const fileType = attachment.contentType.split('/')[0];

if (fileType == 'image') {
const newAttachment = new AttachmentBuilder(attachment.url, { name: attachment.name });

const imageEmbed = new EmbedBuilder()
.setColor('ff2a2a')
.setImage(`attachment://${newAttachment.name}`)

logChannel.send({ embeds: [imageEmbed], files: [newAttachment] });
}
}
9 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 6/10/2024 in #djs-questions
Authorize modal
What's the best way to authorize a modal in order to know it came from the right user? I'd prefer nog to use the interaction.id in the customId, so is it an option to use client.on(modalSubmit)?
8 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 5/30/2024 in #djs-questions
RequestAbortedError when uploading files
I tried uploading files from 18.3MB and 23.9MB as attachments below one message. I'm getting this error message: RequestAbortedError [AbortError]: Request aborted What can I do about this?
6 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 4/3/2024 in #djs-voice
Bot stops playing when rejoining another channel
My bot plays in channel1. He uses connection.disconnect() to leave a voice channel, but the connection still exists. After using connection.rejoin({ channelId: channel2.id }) in order to join another voice channel, the bot doesn't play the sound of its subscribed player anymore. But the player is playing the music. What's the solution?
3 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 3/24/2024 in #djs-voice
Cannot perform IP discovery
Is there a way to solve this issue without changing firewall of something? Error: Cannot perform IP discovery - socket closed By the way: for some reason, after a few trials the bot just starts.
2 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 12/3/2023 in #djs-questions
command.permissions.has() always returns true
When using slashCommand.permissions.has({ permissionId: interaction.user.id }), it seems to always return true. Even though the user doesn't have access to that specific command.
10 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 12/2/2023 in #djs-questions
Modal submiting
When a user uses a command, as example /say, a modal pops up using interaction.showModal(modal). But when I use interaction.awaitModalSubmit() in the code of this command, I'm having the following issue: When I use the command, close the modal, use the command again and submit the modal: the first command receives the second commands modal too. So I get 2 answers instead of only the last. I also had an issue that it took other user's modals as well, but I fixed that with a member filter.
5 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 9/20/2023 in #djs-voice
Fetch palyer from voiceConnection
Is there any way to get or fetch the player which a voiceConnection has subscribed?
4 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 6/12/2023 in #djs-voice
Bot disconnects from vc after a few days on external host
My bot disconnects from a voice channel after a few days (no specific number). At the same time, the bot's presence gets removed. I'm not sure whether it had something to do with Discord.js or with the hosting service, so I'm asking the question here first.
4 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 4/6/2023 in #djs-voice
Check whether resource is valid
Is there a way to check whether a resource is a valid audio resource?
6 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 4/6/2023 in #djs-questions
Command localizations in guilds
When I create a slash command with description localization, I can fetch the command and it will show the localizations. But when I fetch a guild command with description localization, it won't show it. Is there a way to fix this?
3 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 4/5/2023 in #djs-questions
Command localizations
When I log a slash command in a certain guild, it says there are no description localizations, but I have enabled those. What's wrong?
guild.commands.fetch().then(commands => {
for(const command of commands){
console.log(command)
}
}
guild.commands.fetch().then(commands => {
for(const command of commands){
console.log(command)
}
}
descriptionLocalizations: null,
descriptionLocalized: null,
descriptionLocalizations: null,
descriptionLocalized: null,
2 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 4/5/2023 in #djs-voice
Fetch URL from audio resource
Is there a way to fetch the URL from an audio resource? I'm playing a radio station with my bot.
3 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 4/2/2023 in #djs-questions
Is there a way to unselect a reaction in a select menu?
Is there a way to unselect a reaction in a select menu?
5 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 3/25/2023 in #djs-voice
Question about connection.on
When a voice connection is destroyed, does the connection.on method get destroyed as well? Because I don't want to overload the bot, and I want to create a new connection.on method when creating a new connection.
19 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 3/22/2023 in #djs-voice
Radio
My bot is playing music from an online radio station, but the music stops playing after like 30 seconds. I thought it was something with YouTube only, but it also affects my radio bot. Is there any way to fix it without pauses in between the music?
7 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 3/22/2023 in #djs-questions
Radio music
My bot is playing music from an online radio station, but the music stops playing after like 30 seconds. I thought it was something with YouTube only, but it also affects my radio bot. Is there any way to fix it without pauses in between the music?
5 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 3/20/2023 in #djs-questions
Unknown application command permissions
When I run this code:
guild.commands.fetch().then(commands => {
commands.forEach(command => {
command.permissions.fetch().then(perms => {
console.log(perms)
});
});
});
guild.commands.fetch().then(commands => {
commands.forEach(command => {
command.permissions.fetch().then(perms => {
console.log(perms)
});
});
});
I'm getting the next error: Unknown application command permissions Any solutions?
3 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 2/27/2023 in #djs-questions
Reason for timeout
Hi, just a quick question: how can I receive the reason for a timeout?
12 replies
DIAdiscord.js - Imagine an app
Created by SirNuny on 2/11/2023 in #djs-questions
Problems with setting command permissions using bearer token
I'm having troubles with setting command permissions using a bearer token. On my website, there's an authorisation system with the npm package passport-discord. This gives me an accessToken. When I try to set the command permissions using that token, it gives me the following error: DiscordAPIError[50026]: Missing required OAuth2 scope. I don't know what I'm doing wrong at this moment. Code:
const cmd = await guild.commands.create(commandsData);
cmd.permissions.set({
token: req.user.accessToken,
permissions: rolePermissions
});
const cmd = await guild.commands.create(commandsData);
cmd.permissions.set({
token: req.user.accessToken,
permissions: rolePermissions
});
6 replies