Macros
Table of Contents
Macros
Macros allow you to define reusable blocks of code that can be referenced using #macroName inside your commands, events, or even other macros. This helps to avoid repeating code and makes your bot code more organised.
Syntax
To create a macro, use <client>.macro() and define a name and a code block.
1<client>.macro({2  name: "macroName",3  code: `aoi.js functions`4});You can define multiple macros at once:
1<client>.macro(2  {3    name: "logmessage",4    code: `$log[Hello world!]`5  },6  {7    name: "onlyDevelopers",8    code: `$onlyIf[$authorID==123456789012345678;You are not a developer.]`9  }10);Usage
To use a macro, reference it with a # followed by its name:
#macroNameFor example, using a macro named logmessage:
#logmessageThis will insert the code block defined in the macro at that point in your command or event.
Example
Defining and using multiple macros:
1<client>.macro({2  name: 'logmessage',3  code: `$log[aoi.js bot just started c:]`4}, {5  name: 'onlyDevelopers',6  code: `$onlyIf[$authorID==918231238912839;You are not a developer.]`7});1<client>.readyCommand({2  code: `3    #logmessage4    $log[Starting..]5  `6});1<client>.command({2  name: "eval",3  code: `4    $eval[$message]5    #onlyDevelopers6  `7});