discord.js - Imagine a 👻

DIA

discord.js - Imagine a 👻

Support server for discord.js, a Node.js module to interact with Discord's apps API.

Join

djs-questions

djs-voice

Why is global_name not showing up?

When importing user information such as guilds and rules ex) guild.fetchOwner Why doesn't it show global_name? ...

Bot crashing when calling custom /suggest command

So I have a /suggest command for my discord bot that should take the user's input, and output it to a private text channel 'bot-suggestions'. I've confirmed that it's writing the suggestion to suggestions.txt, but I think the bot is crashing when it tries to send the embed? Not entirely sure what's happening here: ```js // Import required dependencies const { SlashCommandBuilder } = require("@discordjs/builders");...

I'm getting `TypeError: ActionRowBuilder is not a constructor`

I am importing it correctly like so ```js const { Client, ActionRowBuilder,...

Fetch messages older than certain date

I'd like to fetch the most recent messages from a channel that are older than a specific timestamp. E.g. if my limit is 5 days, I want the most recent messages that are at least 5 days old. I noticed the FetchMessagesOptions object has the before parameter, but it works with a specific message ID, not a timestamp. Do I first need to get the oldest message that is less than 5 days old, and then use that message's ID as the before value? Because I'm not sure how I could do this efficiently without unnecessary API requests. Or is there a better way?...

Am I able to show a .txt file in the ini language?

The language "ini" makes my ticket's transcript look nice, but I would like to keep it a .txt file instead of .ini

Not finding an announcement channel

Hello, I dont know why, but it seems like it doesnt find the announcement channel. ```js const banGlobalChannelId = '1123739036394201188'; const banGlobalChannel = client.channels.cache.get(banGlobalChannelId); if (banGlobalChannel && (banGlobalChannel.type === 'GUILD_TEXT' || banGlobalChannel.type === 'GUILD_ANNOUNCEMENT')) {...

Setting autocomplete options based on other option's value

I'm trying to make it so one autocomplete option (type)'s choices are based on the value of another option (category) within the same command. When I first set the value of category - which is a non-autocomplete string choice option - and I move to the autocomplete option type it successfully populates its choices according to the value of category. However, when I go back and change the value of category to something else, then move to the type option, the proper corresponding choices only populate correctly if I type at least one letter. If I do not, it populates it with the previously set of choices, corresponding to the first value set for category. I've attached a GIF that will hopefully help understand my issue. Thank you!...

Reaction Roles

How can I make Reactions that give you roles when you click it is there a simple way to do this most I've seen are long and complex

Checking permission to create channels/roles

I have a command which can create a channel and/or role so I have code to ensure the bot has the correct permission to do so as shown below: ```ts public static async canCreateChannel(guild: Guild): Promise<boolean> { let botMember = await guild.members.fetchMe(); ...

ShardingManager doesnt work with .ts files

I am trying to make a discord bot with typescript that uses shards, however the sharding manager crashes when I pass in a ts file like so: ```js const manager = new ShardingManager("./src/bot.ts", { totalShards: "auto", token,...

Bot seems to be uploading the same media file multiple times?

Bot has been perfectly fine for the past week. However, when simply posting a message as a bot that only contains a media file, the bot seems to be spam uploading it, again, and again.

Rate limits for /interactions & /webhooks

https://discord.com/developers/docs/interactions/receiving-and-responding#endpoints On this page it says "The endpoints below are not bound to the application's Global Rate Limit" Though the @discordjs/rest package is setup to rate limit all /webhooks paths the same so editing interactions and following up gets globally rate limited with the current code. Would it be recommended to open a Pull Request to fix this in the @discordjs/rest package?...

Shard 76's Client took too long to become ready.

```js Error [SHARDING_READY_TIMEOUT]: Shard 76's Client took too long to become ready. at Timeout.onTimeout (...\node_modules\discord.js\src\sharding\Shard.js:166:16) at listOnTimeout (node:internal/timers:569:17) at process.processTimers (node:internal/timers:512:7) {...

Pagination error

Hey, I have a problem with my pagination. I'll attach a video so you can understand the problem. Here's my code: https://sourceb.in/k6HUMLoMJ2

Storing & retreving input from slash command strings

Is there a way I can store the input from a slash command to use later in another command? I have been following the discord.js bot setup guide and can't seem to find a way to do this. I want users to be able to add their own tasks to a to do list, and then view the to do list with another slash command....

discord bot in same server as NEXTJS Backend

How to make (export) discord bot to be alive (import) to rest of the NEXTJS server files?

I made it look like an image, but I get the error "something went worng!"

https://www.youtube.com/watch?v=qNB7pQBhqDQ Modal code was created as in the corresponding image. However, the error "something wrong! Try again!" occurs. Below is the code I wrote. ```const { SlashCommandBuilder, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder } = require('discord.js');...

const client = new Client({ intents: [GatewayIntentBits.Guilds] });

Is there a whole list of intents that I can add on to GatewayIntentBits? Also GateWayIntentBits is websocket right?...

[MONGOOSE/MONGODB] How can I get a specific users schema?

Hello! I've been coding for the past few hours and can't exactly seem to figure this out so I've been trying to get a specific users totalMessages (from schema) at a specific date, heres my code (this is being run inside my command file, level/messages.js): ```js...

how do i use ``Role.icon`` hash? to get the icon?

how do I use Role.icon hash? to get the icon? like URL for image etc.