Skip to main content

Classes Options

AoiClient

OptionDescription
tokenThe token for authentication.
telegramOptions for the Telegram integration (See TelegramOptions below).
databaseOptions for the database (See DatabaseOptions below).
disableFunctionsFunctions that will be removed from the library's loading functions (string array).
customFunctionAn array of custom functions (See DataFunction[] below).
functionErrorFor the error handler of functions (boolean).
sendMessageErrorTo disable text errors (boolean).
disableAoiDBDisabled built-in database (boolean, optional).
loggingOutputting system messages to the console (boolean, optional).
autoUpdateChecks for available package updates and performs an update if enabled (boolean, optional).

Additional Types

TelegramOptions

Configuration options for interacting with the Telegram API.

OptionDescription
limitThe maximum number of updates to fetch at once. Defaults to 100 (number).
timeoutThe timeout for long polling in seconds. Defaults to 60 seconds (number).
allowed_updatesAn array of allowed update types to receive. Defaults to all updates.
sessionAn optional session object for managing user sessions (unknown type).

KeyValueOptions

Configuration options for the KeyValue database connection.

OptionDescription
pathThe file path to the database storage (string).
tablesAn array of table names within the database (string array).
extnameThe file extension name used for the database file (string).
loggingLog ready database (boolean).

MongoDBManagerOptions

Configuration options for the MongoDB database connection.

OptionDescription
urlMongoDB connection URL (string).
tablesAn array of table names within the database (string array).
loggingLog ready database (boolean).

DatabaseOptions

General database options for AoiClient.

OptionDescription
typeType of the database ("MongoDB" or "KeyValue").
Further options depend on the selected type.
const bot = new AoiClient({
token: "YOUR_BOT_TOKEN_HERE",
telegram: {
/** The maximum number of updates to fetch at once. Defaults to 100. */
limit: 100,
/** The timeout for long polling in seconds. Defaults to 60 seconds. */
timeout: 60000,
/** An array of allowed update types to receive. Defaults to all updates. */
allowed_updates: [],
/** An optional session object for managing user sessions */
session: {},
},
database: {
/** The available database type to be used is MongoDB, with KeyValue as the default **/
type: "KeyValue",
/** The link for connecting to MongoDB **/
url: "mongodb+srv:...",
/** The file path to the database storage. */
path: "./database/",
/** An array of table names within the database.*/
tables: ["main"],
/** The file extension name used for the database file. */
extname: ".sql",
},
/** Functions that will be removed from the library's loading functions. **/
disableFunctions: [],
/** An array of customFunction functions **/
customFunction: [],
/** For the error handler of functions **/
functionError: true,
/** To disable text errors **/
sendMessageError: true,
/** Disabled built-in database. **/
disableAoiDB: false,
/** Outputting system messages to the console. **/
logging: true,
/** Checks for available package updates and performs an update if enabled (beta) **/
autoUpdate: {
/** Displaying messages about new versions. **/
aoiWarning: true,
/** Whether automatic updates are enabled. **/
autoUpdate: true,
/** Whether to enable development versions. **/
enableDev: true,
/** Whether to enable beta versions. **/
enableBeta: true,
},
});