-
-
Notifications
You must be signed in to change notification settings - Fork 0
Bot
Creates new bot instance within given pass phrase and options
-
Type
function createBot(passPhrase: string, options: botOptions): Bot;
-
References
-
Type
interface botOptions { enableSSL?: boolean; logger?: any; nodes: string[]; }
-
Type
interface Bot { api: Api; } class Api {}
Error handler set via Bot.catch()
-
Type
interface Bot { handleError: ErrorHandler; }
-
References
Sets the bot's error handler
-
Type
interface Bot { catch(handleError: ErrorHandler): void; }
-
References
Registers some middleware that will only be executed when the bot received a message that starts with the specifid command.
-
Type
interface Bot { command(name: string, ...handlers: Handler[]): void; }
-
Details
The commands must meet the following criteria:
- The command must start with a forward slash character (/).
- The command must be composed of one or more uppercase or lowercase letters.
- The letters in the command may be separated by one underscore (_).
- The command must end with a single letter.
-
Example
The following route will match
/hello
commandbot.command('hello', () => {})
-
References
Decodes and processes a new transaction, could be used for testing or handling transactions from other sources
-
Type
interface Bot { handle(transaction: CryptedTransaction): void; }
Registers some middleware(s) that will only be executed when the message contains some text specified by pattern
-
Type
interface Bot { hears(pattern: Pattern, ...handlers: Handler[]): void; }
-
Example
This route will match butterfly and dragonfly, but not butterflyman, dragonflyman, and so on.
bot.hears(/.*fly$/, () => {})
-
References
Starts the webhook client and listens for new messages
-
Type
interface Bot { start(): void; }
Registers some middleware
-
Type
interface Bot { use(...handlers: Handler[]): void; }
-
References