🌎Global Variables
Global variables are variables that do not need to be declared to be invoked. For example: function, const, let, etc...
If you declare a variable with the same name or reset the value, the global variable will be overwritten with the defined value.
Global Variables - Boolean
Variable
Value
Usage
animated
true
Typically used to set the emoji to animated
disabled
true
Typically used to set the component to disabled
ephemeral
true
Typically used to set the message to ephemeral
fetchReply
true
Typically used to fetch the message from an interaction
inline
true
Typically used to set fields inline into an embed
required
true
Typically used to set the component/option is required
// Before
await interaction.reply({
content: "Hello World 😀",
ephemeral: true
});
// After
await interaction.reply({
content: "Hello World 😀",
ephemeral
});
console.log(disabled); // true
const disabled = false;
console.log(disabled); // false
console.log(inline); // true
inline = false;
console.log(inline); // false
Variable - sleep
import { setTimeout as sleep } from "node:timers/promises";
(async () => {
console.log("1");
await sleep(5000); // Pause the code for 5 seconds
console.log("2");
})();
Last updated