addamsson
Explore posts from serversDIAdiscord.js - Imagine a boo! 👻
•Created by addamsson on 5/7/2024 in #djs-questions
My bot doesn't get the full list of channels on a server
Hi there! I'm working on a bot that posts messages in a channel and I've just noticed that this functionality no longer works. I did some digging and it seems that not all channels are listed when using
client.channels.cache
. I checked all permissions, and viewed the server by using the bot's role and everything looks fine, my bot is supposed to see the relevant channels, but when I do this:
only a subset of all visible channels is returned. I double checked and the channel id I'm using (myChannelId
) is good, but it is not in the list. Am I supposed to invalidate the cache somehow? What am I missing?65 replies
DIAdiscord.js - Imagine a boo! 👻
•Created by addamsson on 10/10/2023 in #djs-questions
How to send a message to a channel?
12 replies
DIAdiscord.js - Imagine a boo! 👻
•Created by addamsson on 9/18/2023 in #djs-questions
onInteractionCreate doesn't get called when I select a previously deselected parameter
I have a command that has 2 autocomplete parameters:
By default it pops up the
org
as an option which works fine, but if I press backspace and delete this suggestion I can select other parameters. In my case I selected team
, and proceeded to select a team
. After that when I select org
from the parameters I get displayed the previous suggestions. My problem is that I have some code that filters organizations if a team is selected:
This works if the user starts to type something, but the whole InteractionCreate
callback doesn't get called when I simply select org
, the old list is displayed instead. How can I force the reloading of the organizations that the user can pick? I'd like to use autocomplete as it is possible that there are many organizations / teams to choose from.8 replies
DIAdiscord.js - Imagine a boo! 👻
•Created by addamsson on 9/12/2023 in #djs-questions
How to make sure that a channels.create call followed by a channels.fetch call is consistent?
Right now I have some code that creates a category and then adds some channels to it. What I've noticed is that there is some sort of race condition.
Whenever I create a new category with
then there is a seemingly random chance that a subsequent
call will not contain the newly created category. How can i make sure that
fetch
is in a happens-before relationship with create
?
Note that I also tried:
to no avail. 😦5 replies
DIAdiscord.js - Imagine a boo! 👻
•Created by addamsson on 9/8/2023 in #djs-questions
How to create a new channel for a guild?
I have a bot that will create a text channel to write into when invited. My question is how can I do this with discord.js? More specifically. I have this code that I have written by just exploring the API:
I'm guessing that this will work, but I'm not sure I understand what
cache
is about. I've seen this throughout the API, but I'm not sure how it works. Do I have to load the cache, or does it happen lazily whenever I try to interact with something?78 replies