kokastar
kokastar
DIAdiscord.js - Imagine an app
Created by kokastar on 7/1/2023 in #djs-questions
How to Respond to the interaction without displaying anything
I have created a function to edit the message according to the StringSelectMenu selection. However, the message "This interaction failed" is displayed even if the message is successfully edited. Is there any way to respond to the interaction without displaying anything?
7 replies
DIAdiscord.js - Imagine an app
Created by kokastar on 4/2/2023 in #djs-questions
Cannot get online users
I am trying to get an online user on that server when I use the s slash command. At that time, an error occurred. I have tried various devices but could not get it to work. Code
const members = await interaction.guild.members.fetch({ withPresences: true });
const online = members.filter(member => member.presence.status !== "offline").size;
const members = await interaction.guild.members.fetch({ withPresences: true });
const online = members.filter(member => member.presence.status !== "offline").size;
Error
TypeError: Cannot read properties of null (reading 'status')
TypeError: Cannot read properties of null (reading 'status')
10 replies
DIAdiscord.js - Imagine an app
Created by kokastar on 12/11/2022 in #djs-questions
how to add a role from a user ID and a role ID
I would like to assign role using user ID and role ID, but in my research I could only find the following example.
let role= member.guild.roles.cache.find(role => role.name === "role name");
member.roles.add(role);
let role= member.guild.roles.cache.find(role => role.name === "role name");
member.roles.add(role);
Sorry for the rudimentary question.
11 replies
DIAdiscord.js - Imagine an app
Created by kokastar on 12/2/2022 in #djs-questions
Can't sent direct message
I wrote a slash command like this (you should get a DM to yourself when you run the command)
{
data: new SlashCommandBuilder()
.setName('dmtest')
.setDescription('sent direct message'),
async execute(interaction) {
client.users
.fetch('626680496834871308')
.then((user) => {
user.send(`Hello`,);
});
},
{
data: new SlashCommandBuilder()
.setName('dmtest')
.setDescription('sent direct message'),
async execute(interaction) {
client.users
.fetch('626680496834871308')
.then((user) => {
user.send(`Hello`,);
});
},
However, the following error occurs.
throw new Error("Expected token to be set for this request, but none was present");
^

Error: Expected token to be set for this request, but none was present
throw new Error("Expected token to be set for this request, but none was present");
^

Error: Expected token to be set for this request, but none was present
6 replies
DIAdiscord.js - Imagine an app
Created by kokastar on 10/9/2022 in #djs-questions
The third options arguments are not working properly.
https://github.com/NITKC22s/bot-main/blob/main/commands/genshintimer.js Error at line 58 of genshintimer.js. Specifically Option "Notification volume" is of type: 4; expected 3. However, the fact that this error always occurs for the third option, even after changing the order of the options, led me to believe that it is not the code for the option itself, but something else that is wrong. But I could never find it. If someone could tell me what caused it and how to fix it, that would be great.
3 replies