Closed quintendewilde closed 6 years ago
Hi! Seems like you didn't require the module. Use const { Bot } = require('node-vk-bot')
to import it
If it shows "Error: Cannot find module", then use the command npm i node-vk-bot
in shell to install it.
Hi,
Well indeed I forgot that part.
So in my terminal I did node
And than the following
Quintens-MacBook-Pro:vk-bot quintendewilde$ node
> import { Bot } from 'node-vk-bot'
...
... new Bot({
... token: 'myToken',
... prefix: /^Bot[\s,]/,
... prefixOnlyInChats: true,
... chats: [
... 1,
... 2e9 + 12
... ],
... api: {
..... v: 5.38, // must be >= 5.38
..... lang: 'en'
..... }
... })
...
...
Any time I press enter it just shows me 3 dots and its not like its executing anything. I probably should look more in to node and how it works.
The line import { Bot } from 'node-vk-bot'
is for TypeScript only. Since you use NodeJS, you should use
const { Bot } = require('node-vk-bot')
And then it should work.
Hi! Yes, I got a response only thing is I don't think it's a working one! But still a response.
Bot {
domain:
Domain {
domain: null,
_events: { error: [Function: debugDomainError] },
_eventsCount: 1,
_maxListeners: undefined,
members: [] },
_events: {},
_eventsCount: 0,
_maxListeners: undefined,
options:
{ token: 'mytoken',
prefix: /^Bot[\s,]/,
prefixOnlyInChats: true,
chats: [ 1, 2000000012 ],
api: { v: 5.38, lang: 'en' } },
_userEvents: [],
_stop: false }
Also my app on vk is labeled disabled? I tried sending and receiving a message but no response. Thanks for the help so far!
You can enable application in its settings. (Settings -> Application status)
Did you use .start()
method? When you define your bot, it doesn't automatically start to check for new messages.
I've enabled the application on VK! :)
After creating the bot and using .start() I get ```
.start() Invalid REPL keyword
Should .start() get a value to start with?
start is a method of Bot class use it on your bot variable
const bot = new Bot({...})
bot.start()
maybe you should read docs first
Hi, I'm new at this.
but when I run node in my console and then try to create a bot with my token I get following error.