Nlmyr
Nlmyr
DIAdiscord.js - Imagine an app
Created by Nlmyr on 5/20/2024 in #djs-questions
member.joinedAt = null
ok thank you for your info
8 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 5/20/2024 in #djs-questions
member.joinedAt = null
8 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 5/10/2023 in #djs-questions
Update presence @discordjs/core
@d4isdavid I am a Little confused about the new docs. Do you have some advice to read the docs right?
10 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 5/10/2023 in #djs-questions
Update presence @discordjs/core
client.once(
GatewayDispatchEvents.Ready,
async () => console.log(`Ready! Bot started.`),
client.updatePresence(0, {
status: PresenceUpdateStatus.Online,
activities: [
{
name: "with discord.js",
type: 0,
},
],
afk: false,
})
);
client.once(
GatewayDispatchEvents.Ready,
async () => console.log(`Ready! Bot started.`),
client.updatePresence(0, {
status: PresenceUpdateStatus.Online,
activities: [
{
name: "with discord.js",
type: 0,
},
],
afk: false,
})
);
thats my code
10 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 5/10/2023 in #djs-questions
Update presence @discordjs/core
RangeError: Shard 0 not found
PS C:\Users\xxx> node .
C:\Users\xxx\node_modules\@discordjs\ws\dist\index.js:1135
throw new RangeError(`Shard ${shardId} not found`);
^

at SimpleShardingStrategy.send (C:\Users\xxx\node_modules\@discordjs\ws\dist\index.js:1135:13)
at WebSocketManager.send (C:\Users\xxx\node_modules\@discordjs\ws\dist\index.js:1374:26)
at Client.updatePresence (C:\Users\xxx\node_modules\@discordjs\core\dist\index.js:2391:24)
at Object.<anonymous> (C:\Users\xxx\src\main.js:48:10)
at Module._compile (node:internal/modules/cjs/loader:1267:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47

Node.js v20.1.
RangeError: Shard 0 not found
PS C:\Users\xxx> node .
C:\Users\xxx\node_modules\@discordjs\ws\dist\index.js:1135
throw new RangeError(`Shard ${shardId} not found`);
^

at SimpleShardingStrategy.send (C:\Users\xxx\node_modules\@discordjs\ws\dist\index.js:1135:13)
at WebSocketManager.send (C:\Users\xxx\node_modules\@discordjs\ws\dist\index.js:1374:26)
at Client.updatePresence (C:\Users\xxx\node_modules\@discordjs\core\dist\index.js:2391:24)
at Object.<anonymous> (C:\Users\xxx\src\main.js:48:10)
at Module._compile (node:internal/modules/cjs/loader:1267:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1321:10)
at Module.load (node:internal/modules/cjs/loader:1125:32)
at Module._load (node:internal/modules/cjs/loader:965:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47

Node.js v20.1.
10 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 5/10/2023 in #djs-questions
Update presence @discordjs/core
I get the following error:
throw new RangeError(`Shard ${shardId} not found`);
^

RangeError: Shard 0 not found
throw new RangeError(`Shard ${shardId} not found`);
^

RangeError: Shard 0 not found
10 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 5/10/2023 in #djs-questions
Update presence @discordjs/core
Yes I look only in the new things there 😅
10 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 5/10/2023 in #djs-questions
Update presence @discordjs/core
const { REST } = require("@discordjs/rest");
const { WebSocketManager } = require("@discordjs/ws");
const {
GatewayDispatchEvents,
GatewayIntentBits,
InteractionType,
MessageFlags,
Client,
} = require("@discordjs/core");
require("dotenv").config();

// Create REST and WebSocket managers directly
const rest = new REST({ version: "10" }).setToken(process.env.TOKEN);

const gateway = new WebSocketManager({
token: process.env.TOKEN,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

// Create a client to emit relevant events.
const client = new Client({ rest, gateway });

// Listen for interactions
// Each event contains an `api` prop along with the event data that allows you to interface with the Discord REST API
client.on(
GatewayDispatchEvents.InteractionCreate,
async ({ data: interaction, api }) => {
if (
interaction.type !== InteractionType.ApplicationCommand ||
interaction.data.name !== "ping"
) {
return;
}

await api.interactions.reply(interaction.id, interaction.token, {
content: "Pong!",
flags: MessageFlags.Ephemeral,
});
}
);

// Listen for the ready event
client.once(GatewayDispatchEvents.Ready, () =>(
console.log(`Ready! Bot started.`);
)
);

// Start the WebSocket connection.
gateway.connect();
const { REST } = require("@discordjs/rest");
const { WebSocketManager } = require("@discordjs/ws");
const {
GatewayDispatchEvents,
GatewayIntentBits,
InteractionType,
MessageFlags,
Client,
} = require("@discordjs/core");
require("dotenv").config();

// Create REST and WebSocket managers directly
const rest = new REST({ version: "10" }).setToken(process.env.TOKEN);

const gateway = new WebSocketManager({
token: process.env.TOKEN,
intents: GatewayIntentBits.GuildMessages | GatewayIntentBits.MessageContent,
rest,
});

// Create a client to emit relevant events.
const client = new Client({ rest, gateway });

// Listen for interactions
// Each event contains an `api` prop along with the event data that allows you to interface with the Discord REST API
client.on(
GatewayDispatchEvents.InteractionCreate,
async ({ data: interaction, api }) => {
if (
interaction.type !== InteractionType.ApplicationCommand ||
interaction.data.name !== "ping"
) {
return;
}

await api.interactions.reply(interaction.id, interaction.token, {
content: "Pong!",
flags: MessageFlags.Ephemeral,
});
}
);

// Listen for the ready event
client.once(GatewayDispatchEvents.Ready, () =>(
console.log(`Ready! Bot started.`);
)
);

// Start the WebSocket connection.
gateway.connect();
i used this from the doc example
10 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 3/21/2023 in #djs-questions
Message Attachment
missed content
7 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 3/21/2023 in #djs-questions
Message Attachment
i have fixed it
7 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 3/21/2023 in #djs-questions
Message Attachment
If I use this it send the message without attachment
const attachmentBuilder = new AttachmentBuilder(path.join(
__dirname,
"../",
"reports",
`ticket-${row.id}.html.rename`
));

await interaction.channel.send(
`Ticket #${row.id} closed by ${interaction.user.username}`,
{
files: [attachmentBuilder],
}
);
const attachmentBuilder = new AttachmentBuilder(path.join(
__dirname,
"../",
"reports",
`ticket-${row.id}.html.rename`
));

await interaction.channel.send(
`Ticket #${row.id} closed by ${interaction.user.username}`,
{
files: [attachmentBuilder],
}
);
7 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 3/21/2023 in #djs-questions
Message Attachment
oh ok
7 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 1/12/2023 in #djs-questions
Missing author in message object
Ok :/ Thank you for your answer👍
7 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 1/12/2023 in #djs-questions
Missing author in message object
Do someone know why that's happening?
7 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 1/12/2023 in #djs-questions
Missing author in message object
7 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 10/19/2022 in #djs-questions
No focused option for autocomplete interaction
have a nice day
16 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 10/19/2022 in #djs-questions
No focused option for autocomplete interaction
thank you @monbrey
16 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 10/19/2022 in #djs-questions
No focused option for autocomplete interaction
i fixed that
16 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 10/19/2022 in #djs-questions
No focused option for autocomplete interaction
i forgot that
16 replies
DIAdiscord.js - Imagine an app
Created by Nlmyr on 10/19/2022 in #djs-questions
No focused option for autocomplete interaction
oh i see
16 replies