#Expected token to be set for this request, but none was present
31 messages · Page 1 of 1 (latest)
see #faq for tips on how to ask questions
const discordToken = process.env[""];
const channelId = process.env["1089592410360782908"];
const guildId = process.env["1089572362460078120"];
const clientId = process.env["1085245543208464455"];
const rest = new REST({ version: '10' }).setToken(discordToken);
await rest.put(
Routes.applicationGuildCommands(clientId, guildId),
{ body: [activateCommand.toJSON(), statusCommand.toJSON(), deactivateCommand.toJSON()] },
);
}
because you gave it an empty property name
i removed the token
that's not a token
the blank thing in discordToken there should be normally a discord token i removed it
those numbers are environment variable names. those are not tokens/values.
you want me to send the full code?
you can send whatever you want. I'm telling you that's your issue. you're not using process.env correctly
@somber harbor
why ping me? I already told you what you're doing wrong.
that's not how process.env works
(as I explained)
if you want to assign a string to a variable, assign the string to a variable. don't randomly try to use an environment variable that isn't set.
then please help me to fix it
what exactly would you like me to do? write your code for you? I've told you exactly what to fix and how it's wrong.
i dont really understand what you mean
what do you think process.env does?
safe in variables?
if i understood this correctly i did now this
process.env
TOKEN=discordtoken
CHANNEL_ID=1089592410360782908
GUILD_ID=1089572362460078120
CLIENT_ID=1085245543208464455
**
index.js**
const discordToken = process.env["TOKEN"];
const channelId = process.env["CHANNEL_ID"];
const guildId = process.env["GUILD_ID"];
const clientId = process.env["CLIENT_ID"];
Almost right, but the file shouldn’t be named process.env.