Anarchy
Anarchy
DIAdiscord.js - Imagine an app
Created by Anarchy on 8/19/2024 in #djs-questions
Steps I should take to avoid rate limits?
Thank youuuuu
6 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 8/19/2024 in #djs-questions
Steps I should take to avoid rate limits?
I have a question about a way I can more efficiently organize requests so I don't constantly keep the bot maxed in requests. I want to build a system where users can interact with the bot in a private chat and their messages are sent to a public chat anonymously. The challenge is I am planning to have this system going where there is +50 people engaging with this at the same time. I know that every time the bot sends a message I am making requests and I am worried that if the chat is very active I will quickly max out my requests. Do you have suggestions on how to efficiently organize this so that it's scalable to even +200 using this system at the same time?
6 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 8/19/2024 in #djs-questions
Questions about what is "spam" when it comes to messaging users with a bot
Welp, it turns out there aren't clear rules on this, but I probably shoudln't that many people and probably will get my bot blocked.
14 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 8/19/2024 in #djs-questions
Questions about what is "spam" when it comes to messaging users with a bot
I will try there
14 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 8/19/2024 in #djs-questions
Questions about what is "spam" when it comes to messaging users with a bot
Okay, if you don't see the relation then you don't need message
14 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 8/19/2024 in #djs-questions
Questions about what is "spam" when it comes to messaging users with a bot
Discord.js has to comply with discord TOS, so they are directly related
14 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 8/18/2024 in #djs-questions
How many people can my discord bot DM message before it's limited?
@wolvinny 🌈 Got it thank you
4 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 8/3/2024 in #djs-questions
Discord.JS IntelliSense isn't working for my slash command. Any advice?
I ended up using JSDocs and added this:
import { CommandInteraction } from 'discord.js';

/**
* @param {CommandInteraction} interaction
*/
import { CommandInteraction } from 'discord.js';

/**
* @param {CommandInteraction} interaction
*/
5 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
Interesting, I didn't realize that's how it worked.
16 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
Ohhhhhh
16 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
I had to manually run deploy-commands so the slash commands would register. Are you saying that it's intended to be like that?
16 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
The bot is being ran though
16 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
So commands are now registered! But only when I manually run the script; the deploy-commands.js script is still not running on it's own and the bot does not reply with 'pong' or anything when I run the slash command.
16 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
Oh wow, I didn't even catch that. Thank you! I updated the code to this:
(async () => {
const commands = await loadCommands();
const rest = new REST({ version: '10' }).setToken(DISCORD_TOKEN);

// Run all the commands in our specific server
rest
.put(Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID), {
body: commands,
})
.then(() =>
console.log('Successfully registered the application commands!')
)
.catch(console.error);
})();
(async () => {
const commands = await loadCommands();
const rest = new REST({ version: '10' }).setToken(DISCORD_TOKEN);

// Run all the commands in our specific server
rest
.put(Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID), {
body: commands,
})
.then(() =>
console.log('Successfully registered the application commands!')
)
.catch(console.error);
})();
The deploy-commands.js file doesn't seem to run still. None of the console.log() are running. I tried updating my package.json script to include it when I run, but nothing still:
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon ./src/deploy-commands.js && nodemon ./src/index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "nodemon ./src/deploy-commands.js && nodemon ./src/index.js"
},
16 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
None of this code from deploy-commands is running including the console.logs() I have there (i updated it to what I had it originally before deciding to call it in index):
import fs from 'node:fs';
import path from 'node:path';
import { REST } from '@discordjs/rest';
import { Routes } from 'discord.js';
import { DISCORD_TOKEN, CLIENT_ID, GUILD_ID } from '../config.js';

console.log('deploy-commands ran');
function getFiles(dir) {
const files = fs.readdirSync(dir, {
withFileTypes: true,
});

let commandFiles = [];

// Loop through all the files and folders in the `command` folder
for (const file of files) {
// If a folder is being looped over, run `getFiles()` recursively so that all the files in that folder is accounted for
if (file.isDirectory()) {
commandFiles = [...commandFiles, ...getFiles(`${dir}/${file.name}`)];
}
// If what is being looped over a file that ends with .js, then add the file path to `commandFiles`
else if (file.name.endsWith('.js')) {
commandFiles.push(`${dir}/${file.name}`);
}
}

return commandFiles;
}

async function loadCommands() {
let commands = [];
const commandFiles = getFiles('./src/commands');

for (const file of commandFiles) {
const command = await import(path.resolve(file));
// Push all the commands within "data" in each file
commands.push(command.default.data.toJSON());
}

return commands;
}

(async () => {
const commands = await loadCommands();
const rest = new REST({ version: '10' }).setToken(DISCORD_TOKEN);

// Run all the commands in our specific server
rest
.put(
Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID, { body: commands })
)
.then(() =>
console.log('Successfully registered the application commands!')
)
.catch(console.error);
})();
import fs from 'node:fs';
import path from 'node:path';
import { REST } from '@discordjs/rest';
import { Routes } from 'discord.js';
import { DISCORD_TOKEN, CLIENT_ID, GUILD_ID } from '../config.js';

console.log('deploy-commands ran');
function getFiles(dir) {
const files = fs.readdirSync(dir, {
withFileTypes: true,
});

let commandFiles = [];

// Loop through all the files and folders in the `command` folder
for (const file of files) {
// If a folder is being looped over, run `getFiles()` recursively so that all the files in that folder is accounted for
if (file.isDirectory()) {
commandFiles = [...commandFiles, ...getFiles(`${dir}/${file.name}`)];
}
// If what is being looped over a file that ends with .js, then add the file path to `commandFiles`
else if (file.name.endsWith('.js')) {
commandFiles.push(`${dir}/${file.name}`);
}
}

return commandFiles;
}

async function loadCommands() {
let commands = [];
const commandFiles = getFiles('./src/commands');

for (const file of commandFiles) {
const command = await import(path.resolve(file));
// Push all the commands within "data" in each file
commands.push(command.default.data.toJSON());
}

return commands;
}

(async () => {
const commands = await loadCommands();
const rest = new REST({ version: '10' }).setToken(DISCORD_TOKEN);

// Run all the commands in our specific server
rest
.put(
Routes.applicationGuildCommands(CLIENT_ID, GUILD_ID, { body: commands })
)
.then(() =>
console.log('Successfully registered the application commands!')
)
.catch(console.error);
})();
16 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
I am a little stupid and new to discord bots. I tried not calling anything from deploy-commands in index, but nothing from the deploy-commands would run (even the console.log()). So I was desperate and thought I needed to run it in index.js? tbh I am pretty lost on what to do.
16 replies
DIAdiscord.js - Imagine an app
Created by Anarchy on 7/26/2024 in #djs-questions
My slash commands aren't registering in my discord server. Client.on() doesn't seem to run.
No description
16 replies