Squid
DIdiscord.js - Imagine β
β’Created by maybeizen on 11/8/2024 in #djs-questions
Mentioning commands that have subcommands.
You would have to see if each command has any subcommands:
* Check the command's
options
* If any option has the type of ApplicationCommandOptionType.Subcommand
, then add a commandString for each subcommand (aka every top-level option of that command)
* Otherwise, just add a commandString for the top-level command
One thing to note: There's a built-in formatter for command mentions called chatInputApplicationCommandMention
which has parameters for the command id, name, and (optional) subcommand name, which might be easier so its just - {mention} - {command.description}
3 replies
DIdiscord.js - Imagine β
β’Created by luna π on 9/1/2024 in #djs-questions
Bot not appearing in member list
You need to select the
bot
scope when creating your invite link if you want it to be a member of the server (which you do)5 replies
DIdiscord.js - Imagine β
β’Created by ! Milk on 8/1/2024 in #djs-questions
how can i make a footer that display the bot icon and name and time that the command was run in
Also, don't include every version tag and instead only include the version of discord.js that you're actually using
6 replies
DIdiscord.js - Imagine β
β’Created by ! Milk on 8/1/2024 in #djs-questions
how can i make a footer that display the bot icon and name and time that the command was run in
Use
EmbedBuilder#setFooter()
using properties of Client.user
, and EmbedBuilder#setTimestamp()
6 replies
DIdiscord.js - Imagine β
β’Created by JoΓ£ozinho on 7/25/2024 in #djs-questions
How do I make this selected?
Assuming you're using builders
6 replies
DIdiscord.js - Imagine β
β’Created by JoΓ£ozinho on 7/25/2024 in #djs-questions
How do I make this selected?
Use setDefaultValues()
6 replies
DIdiscord.js - Imagine β
β’Created by JoΓ£ozinho on 7/25/2024 in #djs-questions
How do I make this selected?
Specify the default values to include/exclude whatever was selected in the interaction, and update the component with those new default values
6 replies
DIdiscord.js - Imagine β
β’Created by maybeizen on 7/12/2024 in #djs-questions
Function always returns "true".
Also, I believe you need to actually send a message for it to reject
There's no other way to check if DMs are possible until you try and do so
7 replies
DIdiscord.js - Imagine β
β’Created by maybeizen on 7/12/2024 in #djs-questions
Function always returns "true".
You made it an async function already, so theres no reason not to
7 replies
DIdiscord.js - Imagine β
β’Created by maybeizen on 7/12/2024 in #djs-questions
Function always returns "true".
try...catch
only catches promise rejections if you await
the promise7 replies
DIdiscord.js - Imagine β
β’Created by Fancy on 7/6/2024 in #djs-questions
ChannelSelectMenu
Iirc the default values for all select menus are min 0 and max of 1
11 replies
DIdiscord.js - Imagine β
β’Created by ABDULLAH on 7/1/2024 in #djs-questions
How do create poll with my bot?
@ABDULLAH include the
poll
property here7 replies
DIdiscord.js - Imagine β
β’Created by Diamond Pixals on 6/29/2024 in #djs-questions
Create a new category
Call
<Guild>.channels.create(...)
and include type: ChannelType.GuildCategory
8 replies
DIdiscord.js - Imagine β
β’Created by navy on 6/29/2024 in #djs-questions
Fetching guild id and other properties when guild create event is fired
That looks better but try it and see
I see you removed your
client
parameter, so make sure your event listener doesn't pass in the client as the first argument29 replies
DIdiscord.js - Imagine β
β’Created by navy on 6/29/2024 in #djs-questions
Fetching guild id and other properties when guild create event is fired
PS: I recommend using
findOneAndUpdate()
with upsert: true, new: true
and $setOnInsert
to find a document if it exists (using the id as the query), and if it doesn't exist, insert a new document with the remaining fields29 replies
DIdiscord.js - Imagine β
β’Created by navy on 6/29/2024 in #djs-questions
Fetching guild id and other properties when guild create event is fired
Also, you should not include
once: true
since I assume you want to listen for this event multiple times instead of just the first time after your bot has started29 replies
DIdiscord.js - Imagine β
β’Created by navy on 6/29/2024 in #djs-questions
Fetching guild id and other properties when guild create event is fired
You have no reason to construct a new Guild instance; the discord.js Guild constructor is only used internally to create an instance from API data, and you have no reason to be doing that
If you just want the guild that the bot has joined, I assume that would be
const guild = args;
(or just rename args
to guild
since that's all the GuildCreate event emits with anyways)29 replies
DIdiscord.js - Imagine β
β’Created by navy on 6/29/2024 in #djs-questions
Fetching guild id and other properties when guild create event is fired
I recommend you use a linter to warn you of unused variables to call this out in the future since you import your DB model, yet you do not use it anywhere in your code
29 replies
DIdiscord.js - Imagine β
β’Created by navy on 6/29/2024 in #djs-questions
Fetching guild id and other properties when guild create event is fired
(responding here because you crossposted in the main support channel)
You should use your model to create a new guild document in your database, and follow mongoose guides for how to do so (if you're using mongoose, we can't even tell)
You should not use the discord.js Guild class to construct a new discord.js Guild instance, but that is what you are currently doing for some reason
29 replies
DIdiscord.js - Imagine β
β’Created by Mussaplays on 6/23/2024 in #djs-questions
is there is a way to make down menu never expire?
Select menus as message components never expire; the only thing that's expiring is your collector that listens for interactions on that message
You must use your
interactionCreate
event listener with the typeguards like interaction.isMessageComponent()
to always listen for comoponent interactions14 replies