AoiTelegram@0.2.0
Added
- Added parsing of the
object,undefined,null,float,integer,boolean, andNaNtypes (to help with parsing custom functions) - Added the
<Context>.getEvaluateArgsmethod, which combines the<Context>.getArgsand<Context>.evaluateArgsmethods into a single method for easier use in custom functions - Added the
<Context>.checkArgumentTypesmethod for checking the types of arguments passed to custom functions - Added the
<AoiClient>.removeFunctionmethod for removing a function from the list of custom functions - Added the
autoUpdateoption to the constructor of theAoiClientclass 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
defaultimport of classes and constants from the library - Added import of the
DataFunctiontype 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>.loopCommandmethod to start a loop that will execute code at a specified interval (can be stopped using$break) - Added the
<AoiClient>.timeoutCommandmethod to register a timeout command that will be called by$setTimeout - Added the
<AoiClient>.awaitedCommandmethod to start a loop that will execute code at a specified interval using the$loopmethod - 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.sendmethod, 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.actioninstead ofoptions.data
Changed
- The text of errors has been changed, both text and console errors
- The
defaultimport 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-fetchinstead ofaxios - All methods for events
<AoiClient>.<nameEvent>Command,<AoiClient>.command,<AoiClient>.action,<AoiClient>.timeoutCommand,<AoiClient>.awaitedCommandreturn the sameAoiClientclass for convenient use - In the
<Context>.argsCheckmethod, 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@v16and higher - Improved parsing of
object/jsontypes - Improved source code, i.e. comments, code optimization
AoiTelegram functions
Fixed
- Fixed
$ifand$onlyIfparameter 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]