Erin
Erin
DIAdiscord.js - Imagine an app
Created by Erin on 6/24/2023 in #djs-questions
Is there a way to make global app commands (/) only work via DMs?
I know how to prevent global commands from showing up in DMs but I'm wanting the other way around.
18 replies
DIAdiscord.js - Imagine an app
Created by Erin on 4/5/2023 in #djs-questions
Is it not possible to use a boolean with a user option?
I have this command: https://gist.github.com/DudeThatsErin/b0231f2a38cb85309a33de14faac0107 I am receiving an error on the senddm option TypeError [CommandInteractionOptionType]: Option "senddm" is of type: 5; expected 6, 9. I understand what it is saying but I wanted it a boolean because it makes it easier to tell whether someone wants this to print in the server (as a reply) or send the info to the user as a DM. This way I don't have to account for caps lock being on or anything else with a string. Is this not possible to do ?
3 replies
DIAdiscord.js - Imagine an app
Created by Erin on 11/30/2022 in #djs-questions
Strange error 10 min after running command?
https://gist.github.com/DudeThatsErin/21e9fc7bce56dade272fd4b10a783697 I was able to get the suggestion to add to the DB but now when I try to mark a suggestion as completed, it times out. No errors in console. I'm not sure where it is having the issue as nothing seems to happen BUT it does get updated in the DB when I look at the DB. So, the update is happening but nothing gets sent and the thread doesn't get locked or anything. Error: https://gist.github.com/DudeThatsErin/dbfdba65ae363a280427d629b46c4bed
32 replies
DIAdiscord.js - Imagine an app
Created by Erin on 11/22/2022 in #djs-questions
What do I have to do to store how many upvotes and downvotes people have?
12 replies
DIAdiscord.js - Imagine an app
Created by Erin on 11/17/2022 in #djs-questions
How does a bot do this?
18 replies
DIAdiscord.js - Imagine an app
Created by Erin on 11/12/2022 in #djs-questions
Abort error ever since djs v14. Extended timeout but that hasn’t helped.
I have to keep rebooting my server as well as the bot cause it randomly hits the timeout error.
codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:10
self.onError(new RequestAbortedError())
^

RequestAbortedError [AbortError]: Request aborted
at abort (/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:29:5)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:515:73)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_ABORTED'
}
codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:10
self.onError(new RequestAbortedError())
^

RequestAbortedError [AbortError]: Request aborted
at abort (/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:29:5)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:515:73)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_ABORTED'
}
This is incredibly annoying and definitely a bug cause I extended the timeout, yet it still happens, just takes longer to happen.
25 replies
DIAdiscord.js - Imagine an app
Created by Erin on 11/6/2022 in #djs-questions
If I want to make a command that restarts my bot, what is the new client.destroy(); ?
Title. It is saying .destroy() is not a function.
16 replies
DIAdiscord.js - Imagine an app
Created by Erin on 10/28/2022 in #djs-questions
Creating first modal, not sure why it is saying it timed out?
7 replies
DIAdiscord.js - Imagine an app
Created by Erin on 10/21/2022 in #djs-questions
Request aborted error?
I keep receiving this error:
test-bot/node_modules/undici/lib/api/abort-signal.js:10
self.onError(new RequestAbortedError())
^

RequestAbortedError [AbortError]: Request aborted
at abort (/root/test-bot/node_modules/undici/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (/root/test-bot/node_modules/undici/lib/api/abort-signal.js:29:5)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/root/test-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:515:73)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_ABORTED'
}
test-bot/node_modules/undici/lib/api/abort-signal.js:10
self.onError(new RequestAbortedError())
^

RequestAbortedError [AbortError]: Request aborted
at abort (/root/test-bot/node_modules/undici/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (/root/test-bot/node_modules/undici/lib/api/abort-signal.js:29:5)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/root/test-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:515:73)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_ABORTED'
}
Not sure why.
13 replies
DIAdiscord.js - Imagine an app
Created by Erin on 10/18/2022 in #djs-questions
I have this delete-commands.js for slash commands and it isn't working.
https://gist.github.com/DudeThatsErin/b0231f2a38cb85309a33de14faac0107 This is the error message I receive: https://gist.github.com/DudeThatsErin/dbfdba65ae363a280427d629b46c4bed https://i.imgur.com/tEO7dxl.png Not sure why. This bot is in 2 servers.. my test server and its main server. It seems to run fine as the last message.reply sends but then it displays the error. Not sure why this is happening.
10 replies
DIAdiscord.js - Imagine an app
Created by Erin on 10/11/2022 in #djs-questions
Trying to start up my bot but it is getting AbortError Request aborted
[WS => Manager] Manager was destroyed. Called by:
Error
at WebSocketManager.destroy (/root/codinghelp-bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:323:54)
at Client.destroy (/root/codinghelp-bot/node_modules/discord.js/src/client/Client.js:257:13)
at Client.login (/root/codinghelp-bot/node_modules/discord.js/src/client/Client.js:235:12)
at runNextTicks (node:internal/process/task_queues:61:5)
at processTimers (node:internal/timers:499:9)
at async /root/codinghelp-bot/index.js:131:3
/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:10
self.onError(new RequestAbortedError())
^

RequestAbortedError [AbortError]: Request aborted
at abort (/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:29:5)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:515:73)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_ABORTED'
}
[WS => Manager] Manager was destroyed. Called by:
Error
at WebSocketManager.destroy (/root/codinghelp-bot/node_modules/discord.js/src/client/websocket/WebSocketManager.js:323:54)
at Client.destroy (/root/codinghelp-bot/node_modules/discord.js/src/client/Client.js:257:13)
at Client.login (/root/codinghelp-bot/node_modules/discord.js/src/client/Client.js:235:12)
at runNextTicks (node:internal/process/task_queues:61:5)
at processTimers (node:internal/timers:499:9)
at async /root/codinghelp-bot/index.js:131:3
/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:10
self.onError(new RequestAbortedError())
^

RequestAbortedError [AbortError]: Request aborted
at abort (/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:10:18)
at AbortSignal.self.<computed> (/root/codinghelp-bot/node_modules/undici/lib/api/abort-signal.js:29:5)
at AbortSignal.[nodejs.internal.kHybridDispatch] (node:internal/event_target:694:20)
at AbortSignal.dispatchEvent (node:internal/event_target:636:26)
at abortSignal (node:internal/abort_controller:292:10)
at AbortController.abort (node:internal/abort_controller:323:5)
at Timeout.<anonymous> (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/index.js:515:73)
at listOnTimeout (node:internal/timers:559:17)
at processTimers (node:internal/timers:502:7) {
code: 'UND_ERR_ABORTED'
}
No clue why this is happening.
31 replies
DIAdiscord.js - Imagine an app
Created by Erin on 10/11/2022 in #djs-questions
Getting unknown message when the message ID matches the message?
I have zero clue why this is happening... ERROR:
DiscordAPIError[10008]: Unknown Message
at SequentialHandler.runRequest (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:293:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:99:14)
at async REST.request (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/lib/REST.cjs:52:22)
at async MessageManager._fetchSingle (/root/codinghelp-bot/node_modules/discord.js/src/managers/MessageManager.js:101:18) {
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'GET',
url: 'https://discord.com/api/v10/channels/433877613128450061/messages/1029429202744774727',
requestBody: { files: undefined, json: undefined }
}
DiscordAPIError[10008]: Unknown Message
at SequentialHandler.runRequest (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:293:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async SequentialHandler.queueRequest (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/lib/handlers/SequentialHandler.cjs:99:14)
at async REST.request (/root/codinghelp-bot/node_modules/discord.js/node_modules/@discordjs/rest/dist/lib/REST.cjs:52:22)
at async MessageManager._fetchSingle (/root/codinghelp-bot/node_modules/discord.js/src/managers/MessageManager.js:101:18) {
rawError: { message: 'Unknown Message', code: 10008 },
code: 10008,
status: 404,
method: 'GET',
url: 'https://discord.com/api/v10/channels/433877613128450061/messages/1029429202744774727',
requestBody: { files: undefined, json: undefined }
}
Code: https://gist.githubusercontent.com/DudeThatsErin/b0231f2a38cb85309a33de14faac0107/raw/cf60a44de9d4329b462fd93fe2b7849e14ecc1ec/prog-sugg.js Message ID is found in DB and matches the message in the channel. This is for my suggestions command. /suggestions is used to create an embed with a thumbs up and thumbs down in a channel and then it creates a thread related to that suggestion (so we can chat about it). Then this command /suggestionprogress takes the message ID of that embed as well as an "in progress" message. I understand it is saying that this message ID isn't found by discord... I have no clue why.
10 replies
DIAdiscord.js - Imagine an app
Created by Erin on 10/9/2022 in #djs-questions
Is there a way (with slash commands) to press shift+enter to add new lines to messages?
14 replies
DIAdiscord.js - Imagine an app
Created by Erin on 9/7/2022 in #djs-questions
Strange error with help command
Error: https://srcb.in/YMD5CIW6Or help.js: https://srcb.in/t0kOBVwaxT command I'm trying to get help on: bot-status.js: https://srcb.in/ghqsVEok3M I have no idea why this is happening. I'm just running /help botstatus and this error appears.
2 replies
DIAdiscord.js - Imagine an app
Created by Erin on 9/7/2022 in #djs-questions
Slash Command Cooldowns are not working
// command cooldowns
client.slashCooldowns = new Discord.Collection();
const { slashCooldowns } = client;
if (!slashCooldowns.has(interaction.commandName)) {
slashCooldowns.set(interaction.commandName, new Discord.Collection());
}

const now = Date.now();
const timestamps = slashCooldowns.get(interaction.commandName);
console.log('timestamp ', timestamps)
const cooldownAmount = (command.cooldown || 1) * 1000;
console.log('cooldownAmount ', cooldownAmount);
if (timestamps.has(interaction.user.id)) {
const expirationTime = timestamps.get(interaction.user.id) + cooldownAmount;
console.log('expirationTime ', expirationTime)

if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
console.log('timeLeft ', timeLeft)
return interaction.reply({content: `Please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`});
}
}

timestamps.set(interaction.user.id, now);
setTimeout(() => timestamps.delete(interaction.user.id), cooldownAmount);
// command cooldowns
client.slashCooldowns = new Discord.Collection();
const { slashCooldowns } = client;
if (!slashCooldowns.has(interaction.commandName)) {
slashCooldowns.set(interaction.commandName, new Discord.Collection());
}

const now = Date.now();
const timestamps = slashCooldowns.get(interaction.commandName);
console.log('timestamp ', timestamps)
const cooldownAmount = (command.cooldown || 1) * 1000;
console.log('cooldownAmount ', cooldownAmount);
if (timestamps.has(interaction.user.id)) {
const expirationTime = timestamps.get(interaction.user.id) + cooldownAmount;
console.log('expirationTime ', expirationTime)

if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
console.log('timeLeft ', timeLeft)
return interaction.reply({content: `Please wait ${timeLeft.toFixed(1)} more second(s) before reusing the \`${command.name}\` command.`});
}
}

timestamps.set(interaction.user.id, now);
setTimeout(() => timestamps.delete(interaction.user.id), cooldownAmount);
I can still use commands like /help consecutively even when I have the cooldown set to 3000 seconds (to test). As you can see I am logging and it logs up until expirationTime that one does not log. just timestamp and cooldownAmount.
timestamp Collection(0) [Map] {}
cooldownAmount 3000000
timestamp Collection(0) [Map] {}
cooldownAmount 3000000
That's how those log. Not sure why.
8 replies
DIAdiscord.js - Imagine an app
Created by Erin on 9/6/2022 in #djs-questions
Command Cooldowns, is there a way to have a cool down for slash commands?
This is my code for the messageCreate.js event cooldowns: https://srcb.in/so1yvCUNAU I'm not sure if I can or how to adjust it so that it works for slash commands...
2 replies
DIAdiscord.js - Imagine an app
Created by Erin on 9/6/2022 in #djs-questions
I am updating my bot to slash commands and reading them...
https://discord.com/developers/docs/interactions/application-commands Is there a way to have "string" be covered over multiple lines?
6 replies
DIAdiscord.js - Imagine an app
Created by Erin on 9/3/2022 in #djs-questions
With this new change with the bots, is DJS slowly going to require bots to use slash commands?
With this new change with the bots, is DJS slowly going to require bots to use slash commands vs the old way? Cause they are still limited in functionality and there is a reason why bots are still using the old way.
41 replies
DIAdiscord.js - Imagine an app
Created by Erin on 9/1/2022 in #djs-questions
This is my help command... for some reason I am getting these errors which I can't understand
help.js: https://srcb.in/7OTBJgqaWA error: https://srcb.in/WnvtFbKBRg It is strange... I think it is coming from my JSON embeds but it doesn't say where. Or maybe from this line? emb.setFooter({ text: ee.footertext, iconURL: ee.footericon });
4 replies
DIAdiscord.js - Imagine an app
Created by Erin on 8/25/2022 in #djs-questions
message not being sent if missing perms
I have this code:
const botPermissionsIn = message.guild.members.me.permissionsIn(channel);
if(!botPermissionsIn.has(PermissionsBitField.Flags.SendMessages)) return message.author.send(`I can\'t send messages in that channel. I need to have the \`SEND MESSAGES\` permission for that channel. A mod or guild owner will need to update this. If you are seeing this in error, please run the \`${prefix}report\` command.`);

const botPerms = [PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.ReadMessageHistory, ]
let v = 0;
for(const i of botPerms) {
if(!message.guild.members.me.permissionsIn(channel).has(i)) {
v++
}
if(v == botPerms.length) {
message.react('❌');
return message.author.send('I do not have the necessary permissions for this channel. I need \`Read Message History, View Channel, and Send Messages.\`');
}
}
const botPermissionsIn = message.guild.members.me.permissionsIn(channel);
if(!botPermissionsIn.has(PermissionsBitField.Flags.SendMessages)) return message.author.send(`I can\'t send messages in that channel. I need to have the \`SEND MESSAGES\` permission for that channel. A mod or guild owner will need to update this. If you are seeing this in error, please run the \`${prefix}report\` command.`);

const botPerms = [PermissionsBitField.Flags.SendMessages, PermissionsBitField.Flags.ViewChannel, PermissionsBitField.Flags.ReadMessageHistory, ]
let v = 0;
for(const i of botPerms) {
if(!message.guild.members.me.permissionsIn(channel).has(i)) {
v++
}
if(v == botPerms.length) {
message.react('❌');
return message.author.send('I do not have the necessary permissions for this channel. I need \`Read Message History, View Channel, and Send Messages.\`');
}
}
I'm not receiving any DMs for missing perms. Though the error shows in the console.
19 replies