Basically DBKynd is correct. You’re calling the action function before a connection had even been made.
I recommend after the connected event or the join event:
twitchBot.on('join', (channel, username, self) => {
if(self) {
twitchBot.action(channel, 'Joined.')
.catch(err => console.log(err));
}
});