0

I'm currently making a chatbot for a school project. Its goal is to solve problems around school. But there are some issues in my code. I keep getting the following message:

(parameter) index: any
'index' is declared but its value is never read.ts(6133)

And...

TypeError: digibord is not a function
    at digibord.forEach (C:\Users\marti\Chatbot\index.js:47:13)

My code looks like the following:

var digibord =
    {
        name: ["digibord","smartboard","schoolbord"]
    };

function handleMessage(message) {
    digibord.forEach((value, index) => {
        if (value.name.includes(message)) {
            digibord();
            console.log(message);
        }
    });
}

function digibord() {
    const params = {
        icon_emoji: ':smiley:'
    }
    bot.postMessageToChannel('general', 'Okay...In what classroom is your current problem?',params);
};

Any tips on how to solve this?

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Martijn_-
  • 17
  • 7

1 Answers1

1

The first error is just a warning its not being used.

The second one, you have named a function and a variable the same name which you cannot do. Change the name of the variable or function

Derek Lawrence
  • 1,551
  • 2
  • 16
  • 36