Luca | LeCarbonator
Explore posts from serversDIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 6/26/2023 in #djs-questions
awaitMessageComponent breaks if separate message is deleted
I have the following code that awaits either a message, a string select menu or a button:
I also have the following
while
loop that determines what was chosen:
The response should either be parsed as String Select Menu, Button, or a Message that was sent in the same channel.
If it's a message, it should be deleted and the content
stored.
When first starting it up, it works fine. I can change the button / select menu as often as I want.
When sending a message, it gets properly parsed the first time. However, anything after that returns the following error:
Does channel.awaitMessages()
conflict with message.awaitMessageComponent()
?9 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 2/8/2023 in #djs-questions
InteractionCollectorError ignores try/catch block
3 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 10/31/2022 in #djs-questions
createMessageCollector doesn't work, but only in one guild
15 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 10/30/2022 in #djs-questions
Calling promise function twice causes error
I have the following function that should await either a message from the user, or await a button click.
The first time works as intended. Either button clicks or message inputs cause the customId or message content to be available and used.
However, if I try to call the function twice, I get this error:
The code has stopped working ever since implementing this function, so I think it's likely I am missing some problem with it.
However, it's also possible that it's not the function that causes the problem and it's something else instead.
I'd appreciate it if someone else could look at the function and tell me if there's any problems with the execution.
The message variable is the following:
11 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 10/30/2022 in #djs-questions
Is there a way to simultaneously use awaitMessages and awaitMessageComponent?
I'm currently using a do while loop to modify entries in a list. If the user enters "done", it exits that loop. However, I am curious if there's a way to perform that action with a button instead. So the process would be as follows:
- Display list
- Await message and append entry to the list
- ... but if a button is pressed instead, exit the loop.
Up until now, I have worked exclusively with the two methods mentioned in the title. The problem with collector.on listeners is that they do not work in a while loop, since they can't be awaited.
If collector.on listeners are the way to go, I'd like to know if it's possible to place them in a promise.
10 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 10/29/2022 in #djs-questions
awaitMessages filter firing off even though it returns false
11 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 10/27/2022 in #djs-questions
awaitMessageComponent 'Interaction has already been acknowledged' Error
13 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 10/27/2022 in #djs-questions
Client or message undefined
I'm currently trying to code a bot that does the following:
- Awaits slash command, executes the corresponding command file
- File displays entered data in an embed
- User presses a button either to edit provided or add missing info.
The problem is that (as far as I understood), you need a collector to handle it.
The guide lists the following command:
const collector = message.createMessageComponentCollector({ componentType: ComponentType.Button, time: 15000 });
However, I'm not sure what to replace the message object with in this case. Replacing it with interaction
seems to cause an error.
A couple hours ago, I had the same problem with client, where I wanted to use the bot's profile picture in the slash command, but it claimed that client isn't defined
.
The answer I received back then was that "client's available even in command files", but it doesn't seem to be the case.
How can I access
- the bot itself
- the bot's embed message for button interactions
from a commands/foo.js
file?15 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 10/27/2022 in #djs-questions
Accessing .addUserOption Pfp and bot pfp
I'm currently working alongside the online guide, and I've come across an issue I couldn't find.
The current project structure contains a folder "commands", in which each file represents a command. I'm working on one file and try to obtain a target user's profile picture, as well as the bot's profile picture to display in an Embed.
While
interaction.user.displayAvatarURL()
works as expected, I can't seem to figure out how to get the same URL from interaction.options.getUser("user")
. Additionally, I don't know where I can locate the bot's profile picture to begin with. I assumed it's in the client object, but how do I access that from a separate file?
Thanks in advance.11 replies
DIAdiscord.js - Imagine an app
•Created by Luca | LeCarbonator on 10/27/2022 in #djs-questions
Is it possible for an embed field to span multiple rows?
11 replies