It is possible to modify this object, but such modifications will not be
reflected outside the Node.js process, or (unless explicitly requested)
to other Worker threads.
In other words, the following example would not work:
Assigning a property on process.env will implicitly convert the value
to a string. This behavior is deprecated. Future versions of Node.js may
throw an error when the value is not a string, number, or boolean.
import { env } from'node:process';
env.test=null;
console.log(env.test);
// => 'null'
env.test=undefined;
console.log(env.test);
// => 'undefined'
Use delete to delete a property from process.env.
import { env } from'node:process';
env.TEST=1;
deleteenv.TEST;
console.log(env.TEST);
// => undefined
On Windows operating systems, environment variables are case-insensitive.
import { env } from'node:process';
env.TEST=1;
console.log(env.test);
// => 1
Unless explicitly specified when creating a Worker instance,
each Worker thread has its own copy of process.env, based on its
parent thread's process.env, or whatever was specified as the env option
to the Worker constructor. Changes to process.env will not be visible
across Worker threads, and only the main thread can make changes that
are visible to the operating system or to native add-ons. On Windows, a copy of process.env on a Worker instance operates in a case-sensitive manner
unlike the main thread.
@since ― v0.1.27
env.
string|undefined
BOT_TOKEN??"",
intents?:number|IntentStrings|number[]
intents: ["Guilds"],
locations: RCLocations
locations: {
RCLocations.base: string
base:"dist",
RCLocations.commands?:string
commands:"commands",
RCLocations.events?:string
events:"events",
RCLocations.components?:string
components:'components'
}
});
First of all we are going to create a file inside the directory which is set for the components.
Then we are going to create a class that extends ComponentCommand, something like what we do with commands, and then we are going to set the type of the component we want to handle (Buttons or whichever type of SelectMenu)
In this example I have created a component to reply Hello World to the interaction. I have set the customId of the button to hello-world.
Now we want the handler to handle only the interactions created by the HelloWorld button so we will use the customId we have to set in all the components.
To filter the interactions we are using a function inherited by the ComponentCommand class in which we have to return a boolean.