'"Lib not defined" - node.js discord bot

i am trying to make a verification code for my node.js autocode discord bot, here is my code:

let verifiedRole = `${process.env.Verified}`;

//Assigns role to member after using /verify
await lib.discord.guilds['@0.1.0'].members.roles.update({
  role_id: `${verifiedRole}`,
  user_id: context.params.event.member.user.id,
  guild_id: `${context.params.event.guild_id}`,
});

i am getting this error:

RuntimeError: lib is not defined

ReferenceError: lib is not defined
    at (/functions/events/discord/message/button/interaction.js:5:1)

The JSON output of the error is below.
{
  "error": {
    "type": "RuntimeError",
    "message": "lib is not defined",
    "stack": "ReferenceError: lib is not defined\n    at (/functions/events/discord/message/button/interaction.js:5:1)"
  }

can someone please help me???



Solution 1:[1]

The issue is exactly what the error says, you are not defining the variable lib anywhere. You need to define it at the top of the file. According to one of Autocode's examples, it looks something like:

const lib = require("lib")({token: '{{ YOUR IDENTITY TOKEN }}'})`

This line is not shown anywhere within the code provided in your question, so I assume this is the issue you are having. Note that lib must be defined in every file you are using it in, in order to be able to use it in those files. Just having lib in one file doesn't make it accessible as a variable in all of your files.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cannicide