All notable changes to this project will be documented in this file. The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
Note: Patch versions prior to v8.0.0 are not listed.
16.0.0 - 2019-12-28
- Replaced
moment
andmoment-duration-format
dependencies with a simple function. The process uptime output format in stats is different now. - Switched back to
yarn
. - Upgraded dependencies.
15.1.0 - 2019-06-16
Core.getPid
.Core.getOriginalPid
.log.validate
- for now validates onlybot
function's inputs.
- Warning color is now orange.
- Information and response message types now have bold colors, just like the other types.
- Renamed
callback
tohandler
. No change in functionality. - Switched to
eslint
.
- Some types.
- Documentation.
15.0.1 - 2019-06-15
dist/main.d.ts
file.
15.0.0 - 2019-06-15
- Now packaging with
.d.ts
TypeScript declaration files.
- Changes related to keyboards (also see keyboard docs):
kbd.Button
->kbd.button
.kbd.colors.<somecolor>
->kbd.Color.<Somecolor>
.
- Many previously "private" and "readonly" things are now actually private and readonly respectively. See docs for more details.
- JavaScript -> TypeScript.
- Documentation generator:
jsdoc
+minami
theme ->typedoc
. - Package contains minified files for each module instead of one minified file.
log.types.<sometype>
->log.MessageType.<Sometype>
(seelog
docs).
- In case neither
replyText
norattachment
was supplied, this line might have caused a very informative log message to appear, namelybecause there were more arguments supplied than needed. Thanks TypeScript!ctx warn ctx
- Custom messages when required arguments to
bot
and some other functions are not provided aka rudimentary input validation.log.requireParam
.log.requireFunction
.
rollup
devDependency (and its plugins).
14.0.0 - 2019-06-08
- New
Button
types, seeButton
docs and VK API bot keyboard docs for more information.
13.1.3 - 2019-05-11
- Updated to API version 5.95.
13.1.2 - 2019-03-28
- This:
core warn Error in handler: TypeError: Cannot read property 'handler' of undefined
13.1.1 - 2019-03-28
- Update dependencies.
13.1.0 - 2019-02-22
random_id
is now 32-bit.
13.0.3 - 2018-12-26
README.md
contained non-camelCase fields inparams
, while v13.0.0 changed them to be in camelCase.
13.0.2 - 2018-12-25
- Placed
gulp-eslint
indevDependencies
instead ofdependencies
13.0.1 - 2018-12-24
- Merge conflict
13.0.0 - 2018-12-24
- Parameters object passed to
vk.bot()
has now camelCase fields! - Removed starting
_
in fields and methods! - Use Airbnb JavaScript Style Guide with
eslint
instead ofstandard
12.1.0 - 2018-12-04
- Parameter
random_id
is generated and sent with messages automatically
- Updated to API version
5.92
- Build process improvements
12.0.0 - 2018-10-23
- Internal shuffling, no APIs intended for public use have been changed. If you used the logging utilities, refer to the documentation to see how to use it now.
11.0.1 - 2018-10-21
- Moved jsdoc and minami to dev dependencies
- Use
chalk
instead ofcolors
11.0.0 - 2018-10-21
- 🎉 Documentation! 🎉
- Build is now in
dist/vk-chat-bot.min.js
- Renamed fields and methods intended for internal use by adding
_
in front
log.progress
- was intended for internal use, but wasn't actually usedKeyboard#getJSON
- instead,Keyboard
follows the correct structure right away
10.5.1 - 2018-09-14
- Use
yarn
instead ofnpm
10.5.0 - 2018-09-14
- Update to VK API v5.85
10.4.1 - 2018-08-28
- Update dependencies
10.4.0 - 2018-08-24
- Now
payload
handlers can handle not only exactly matching payloads, but also provide a function which, given a payload, will determine whether this handler is the one that needs to handle a specific payload. See the wiki for details.
- Added the payload handlers count to initialization log message
10.3.0 - 2018-08-23
- Payload handlers: see
payload
wiki.
- Now statistics will show uptime in the format
??y ??d ??h ??m ??s
- Since the keyboard in group chats is so smart that it is mentioning the bot automatically when pressing a button, the
cmd
handlers did not want to count it as a proper command. This is now fixed.
10.2.0 - 2018-08-22
- Event
service_action
- see wiki for details - Added the
service_action
event to stats
- Improve log messages
core.help()
now just returns the help message generated when the bot starts, instead of regenerating it each time- Statistics show
??h ??m ??s
instead of seconds - Fix name:
vk-chat-bot
is more framework than a library
10.1.1 - 2018-08-19
- New log style
10.1.0 - 2018-08-19
- Event
start
: triggers when the message's payload is{"command":"start"}
(when user pressed theStart
button) - Accordingly, added the
start
event to stats
- Refactor statistics (use object to keep track of event counts)
- Statistics no longer show empty at startup, instead
Stats initialized
shows up - Use
package.json
"files"
field instead of.npmignore
- Tarball will now include the source map
- Update dependencies
10.0.4 - 2018-08-07
- Update dependencies
10.0.3 - 2018-07-19
- Update dependencies
10.0.2 - 2018-07-08
- Revert to using
require('colors')
10.0.1 - 2018-07-08
- Now using
import 'colors'
instead ofrequire('colors')
- README example issue
10.0.0 - 2018-07-07
- The way how the bot is created is a bit different (see wiki for details or below for migration guide)
- Put warning when calling
no_match
event back in
Migration Guide (from v9.3.1)
Instead of:
const ChatBot = require('vk-chat-bot')
var params = {/* ... */}
var bot = new ChatBot(params)
bot.on(/* ... */)
bot.cmd(/* ... */)
bot.regex(/* ... */)
bot.noEventWarnings()
var helpMessage = bot.help()
bot.start(/* port */)
Use:
const vk = require('vk-chat-bot')
var params = {
/* ... */,
port: 12345
}
var {bot, core} = vk.bot(params)
core.on(/* ... */)
core.cmd(/* ... */)
core.regex(/* ... */)
core.noEventWarnings()
var helpMessage = core.help()
bot.start()
Also, to get the keyboard classes and object, now use:
var Keyboard = vk.kbd.Keyboard
var Button = vk.kbd.Button
var colors = vk.kbd.colors
9.3.1 - 2018-07-05
- Duplication of messages when
no_match
is called
9.3.0 - 2018-07-05
- Keyboard tests
- Refactored event handling code in
Core
- it should be faster now - Improved API call queue processing. Now processing does not start when another is already in progress
- Renamed
Behavior
toCore
- No log messages while
process.env.TEST_MODE
istrue
(it is set bytest/test.js
)
- Only one handler per event is allowed (it already was so, but now, when you try to add another one, it throws an error)
9.2.0 - 2018-07-04
9.1.1 - 2018-07-04
9.1.1 - 2018-07-04
- Updated
babel-polyfill
->@babel/polyfill
9.1.0 - 2018-07-04
- Now using
babel
,rollup
, anduglify-js
to be able to use latest ES features.
9.0.1 - 2018-07-03
handler_error
events to the statistics
- Moved files around in
src
9.0.0 - 2018-07-03
- Log errors in handlers as warnings
handler_error
event, which gets called if an error is thrown in a handler
- Renamed
APIBuffer
toContext
- Use
async
/await
inAPI
,Context
andBehavior
. See the wiki page forAPI#scheduleCall
to learn more about the new usage API#scheduleCall
now, instead of returning the full JSON, returns aPromise
, which, if the call was completed successfully, resolves withjson.response
- No duplicate stats anymore. The bot will log stats only if they changed (not taking uptime into account)
- Empty stats are printed right after Stats object initializes
- Check if the API call was successful now rejects only if
response
isnull
orundefined
, because values like0
orfalse
are ok
8.3.2 - 2018-07-02
- Some package keywords
- Show only error code and message when API error happens
- Log the full JSON if it's neither a
response
nor anerror
- When no message is sent due to
message_deny
event, make a warning instead of information - The name of the main library file changed from
vk-chat-bot.js
tomain.js
(package.json
changed accordingly)
- When receiving an unsupported event, do not produce an error, just make a warning (this is not fatal)
8.3.1 - 2018-07-02
ChatBot#noEventWarnings
function now warns that warnings are disabled (once)
8.3.0 - 2018-07-02
ChatBot#noEventWarnings
function to suppress warnings about "no matching event ... handler found"
- When warning about "don't know how to respond to ...", replace
\n
with\\n
to make log nicer
8.2.2 - 2018-07-02
- Improve token permission check error message
8.2.1 - 2018-07-02
- Revert to using bluebird promises
8.2.0 - 2018-07-02
- Now using native promises instead of bluebird (
request-promise
->request-promise-native
) - In promises, emit warnings, not errors
- Statistics formatting and colors
- Check if the message was actually sent, and if that is not the case, emit a warning
8.1.0 - 2018-07-02
- Now, instead of spamming the log like crazy, the bot will collect some stats and log them each ~10s (see Logging wiki for more information).
8.0.0 - 2018-07-01
APIBuffer#noAutoSend
function- More information and warnings to the log, changed error symbol from
[!]
to[!!]
(see Logging wiki for more information)
- Starting from this version, the bot will prevent adding behavior if it is already running!
- The way bot processes the API call queue
- Renamed
vk_api_key
tovk_token
in Params object. - Updated order of parameters in
Chat-Bot#cmd
. - Added some colors to the output
- Improved error handling
- Updated to VK API version
5.80
- APIBuffer now uses Peer ID instead of User ID
uid
->pid
setUid()
->setPid()
- Bot now checks if the token has the
messages
permission when initialized and logs the check result.
API.scheduleCall()
method
APIBuffer.send()
usesAPI.scheduleCall()
it now- Improved command detection
- Attachment functionality, see API Buffer wiki for more information.
- Some tests
- Improved parameter checks
- Some tests
- Now using classes
Now use:
const ChatBot = require('vk-chat-bot');
var params = {/* ... */}
bot = new ChatBot(params);
Instead of:
const bot = require('vk-chat-bot');
var params = {/* ... */}
bot.init(params);
- Help message generation based on commands' descriptions (
help
function)
- Support for
message_reply
event
- Full objects now passed to handlers
no_match
event
- Check if
message_deny
event and don't send a message if it is
- Behavior-defenition function names:
event
->on
;on
->cmd
;onlike
->regex
- Simplified
null
andundefined
checks