Invalid Bot Token

Heres my register commands code
...(async () => {
  try {
    const rest = new REST({ version: '9' }).setToken(process.env.DISCORD_TOKEN1);
    await rest.put(
      Routes.applicationGuildCommands(process.env.CLIENT_ID1, process.env.SERVER_ID1),
      { body: commands }
    );
    console.log('Successfully registered application commands.');
  } catch (e) {
    console.error(`There was an error: ${e}`);
  }
})();

AND HERES MY CONSOLE
There was an error: DiscordAPIError[0]: 401: Unauthorized

I understand the simplest answer would be that my token is invalid but i have removed and replaced it like 20 different times to no avail. i have also succesfully run other bots with the same code just fine
Was this page helpful?