👨💻Quick Start
You can use npm, yarn or pnpm to install de djs-protofy library
How to install
npm i djs-protofy
The code below must be located in the main file of your application, usually called index or main
require("djs-protofy/init");
JavaScript and TypeScript
require("djs-protofy/init");
const { ChannelType, Client, GatewayIntentBits } = require("discord.js");
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.on("messageCreate", async (message) => {
if (message.content === "-ping") {
const channel = client.channels.getById(string, ChannelType.GuildText);
if (channel) await channel.send({ content: "pong" });
}
});
client.login();
Using with sharding
require("dotenv/config");
const { ShardingManager } = require("discord.js");
const manager = new ShardingManager("shard.js");
manager.spawn();
require("djs-protofy/init");
const { Client, GatewayIntentBits } = require("discord.js");
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
client.on("ready", () => {
console.log("ready");
client.users.getById(string); // User | undefined
});
client.login();
Last updated