AoiTelegram@0.2.0
Added
- Added parsing of the
object
,undefined
,null
,float
,integer
,boolean
, andNaN
types (to help with parsing custom functions) - Added the
<Context>.getEvaluateArgs
method, which combines the<Context>.getArgs
and<Context>.evaluateArgs
methods into a single method for easier use in custom functions - Added the
<Context>.checkArgumentTypes
method for checking the types of arguments passed to custom functions - Added the
<AoiClient>.removeFunction
method for removing a function from the list of custom functions - Added the
autoUpdate
option to the constructor of theAoiClient
class to automatically update the library to the latest version (defaults tofalse
) - Added the ability to return only a string in
<AoiClient>.addFunction
, instead of a function - Added the
default
import of classes and constants from the library - Added import of the
DataFunction
type has been added so that you can use it in the custom function loader fortypescript
. - This update added methods and functions related to intervals and timeouts. Intervals execute code infinitely at regular intervals (they are restarted when the bot is restarted, not continued). Timeouts execute code after a specified time and only once (when the bot is restarted, they do not stop but continue to work until the time runs out and the command is executed)
- Added the
<AoiClient>.loopCommand
method to start a loop that will execute code at a specified interval (can be stopped using$break
) - Added the
<AoiClient>.timeoutCommand
method to register a timeout command that will be called by$setTimeout
- Added the
<AoiClient>.awaitedCommand
method to start a loop that will execute code at a specified interval using the$loop
method - This is also supported by the loader documentation.
- Added the
Fixed
- The
<AoiClient>.command
,<AoiClient>.action
, and the loader created multiple event handlers, which could lead to inefficient use of resources and code complexity - Fixed an error where a function was used where there were no available methods to run it, and instead of an error in the chat, we received an error that there was no
this.telegram.send
method, now a normal error will be displayed in the console about this (this happened when we checked the function parameters) - In the loader for
action
, the expected parameters expectedoptions.action
instead ofoptions.data
Changed
- The text of errors has been changed, both text and console errors
- The
default
import of commands and functions has been changed, now instead ofexport const data = {}
you will have to useexport default {}
. Improved for TypeScript users - The package now fully uses
node-fetch
instead ofaxios
- All methods for events
<AoiClient>.<nameEvent>Command
,<AoiClient>.command
,<AoiClient>.action
,<AoiClient>.timeoutCommand
,<AoiClient>.awaitedCommand
return the sameAoiClient
class for convenient use - In the
<Context>.argsCheck
method, you no longer need to specify the variable name
Other
- The function register no longer affects the call
- Dependencies have been updated to more reliable ones
- Now supports
nodejs@v14
, not as previouslynodejs@v16
and higher - Improved parsing of
object/json
types - Improved source code, i.e. comments, code optimization
AoiTelegram functions
Fixed
- Fixed
$if
and$onlyIf
parameter parsing
Added
$loop[id;interval until next execution;object to be passed]
$awaitedData[path to value?]
$break
$setTimeout[id timeout;time to launch milliseconds;object to be passed]
$timeoutData[path to value?]
$math[mathematical solution]
$eventData[path to value?]
$addCallbackQuery[index;button name;button id]