@types/hubot

  • Version 11.1.0
  • Published
  • 11.2 kB
  • 3 dependencies
  • MIT license

Install

npm i @types/hubot
yarn add @types/hubot
pnpm add @types/hubot

Overview

TypeScript definitions for hubot

Index

Classes

class Adapter

class Adapter extends EventEmitter {}

    constructor

    constructor(robot: Robot<Adapter>);

      property robot

      robot: Robot<Adapter>;

        method close

        close: () => void;

          method emote

          emote: (envelope: Envelope, ...strings: string[]) => void;

            method http

            http: (url: string) => ScopedClient;

              method play

              play: (envelope: Envelope, ...strings: string[]) => void;

                method receive

                receive: (message: Message) => void;

                  method reply

                  reply: (envelope: Envelope, ...strings: string[]) => void;

                    method run

                    run: () => void;

                      method send

                      send: (envelope: Envelope, ...strings: string[]) => void;

                        method topic

                        topic: (envelope: Envelope, ...strings: string[]) => void;

                          method userForId

                          userForId: (id: string, options?: {}) => User;

                            method userForName

                            userForName: (name: string) => User | null;

                              method users

                              users: () => any;
                              • Returns

                                an object containing all the users with property names that are the user id and with the value set as the User. You can iterate over them all with for (const id in users())

                                Deprecated

                              method usersForFuzzyName

                              usersForFuzzyName: (fuzzyName: string) => User[];

                                method usersForRawFuzzyName

                                usersForRawFuzzyName: (fuzzyName: string) => User[];

                                  class Brain

                                  class Brain<A extends Adapter> extends EventEmitter {}

                                    constructor

                                    constructor(robot: Robot<A>);

                                      method close

                                      close: () => void;

                                        method get

                                        get: (key: string) => any;

                                          method mergeData

                                          mergeData: (data: {}) => void;

                                            method remove

                                            remove: (key: string) => this;

                                              method resetSaveInterval

                                              resetSaveInterval: (seconds: number) => void;

                                                method save

                                                save: () => void;

                                                  method set

                                                  set: (key: string, value: any) => this;

                                                    method setAutoSave

                                                    setAutoSave: (enabled: boolean) => void;

                                                      method userForId

                                                      userForId: (id: string, options?: {}) => User;

                                                        method userForName

                                                        userForName: (name: string) => User | null;

                                                          method users

                                                          users: () => any;
                                                          • Returns

                                                            an object containing all the users with property names that are the user id and with the value set as the User. You can iterate over them all with for (const id in users())

                                                          method usersForFuzzyName

                                                          usersForFuzzyName: (fuzzyName: string) => User[];

                                                            method usersForRawFuzzyName

                                                            usersForRawFuzzyName: (fuzzyName: string) => User[];

                                                              class CatchAllMessage

                                                              class CatchAllMessage extends Message {}

                                                                constructor

                                                                constructor(message: Message);

                                                                  property message

                                                                  message: Message;

                                                                    class DataStore

                                                                    class DataStore {}

                                                                      constructor

                                                                      constructor(robot: Robot<Adapter>);

                                                                        method get

                                                                        get: (key: string) => Promise<any>;

                                                                          method getObject

                                                                          getObject: (key: string, objectKey: string) => Promise<any>;

                                                                            method set

                                                                            set: (key: string, value: any) => Promise<void>;

                                                                              method setArray

                                                                              setArray: (key: string, value: any) => Promise<void>;

                                                                                method setObject

                                                                                setObject: (key: string, objectKey: string, value: any) => Promise<void>;

                                                                                  class DataStoreUnavailable

                                                                                  class DataStoreUnavailable extends Error {}

                                                                                    class EnterMessage

                                                                                    class EnterMessage extends Message {}

                                                                                      property text

                                                                                      text: null;

                                                                                        class LeaveMessage

                                                                                        class LeaveMessage extends Message {}

                                                                                          property text

                                                                                          text: null;

                                                                                            class Message

                                                                                            class Message {}

                                                                                              constructor

                                                                                              constructor(user: User, done?: boolean);

                                                                                                property id

                                                                                                id: string;

                                                                                                  property room

                                                                                                  room: string;

                                                                                                    property text

                                                                                                    text: string;

                                                                                                      property user

                                                                                                      user: User;

                                                                                                        method finish

                                                                                                        finish: () => void;

                                                                                                          class Middleware

                                                                                                          class Middleware<T extends Adapter = Adapter> {}

                                                                                                            constructor

                                                                                                            constructor(robot: Robot<T>);

                                                                                                              property stack

                                                                                                              stack: MiddlewareHandler<T>[];

                                                                                                                method execute

                                                                                                                execute: (
                                                                                                                context: MiddlewareContext<T>,
                                                                                                                next: NextFunction,
                                                                                                                done: DoneFunction
                                                                                                                ) => void;

                                                                                                                  method register

                                                                                                                  register: (middleware: MiddlewareHandler<T>) => void;

                                                                                                                    class Response

                                                                                                                    class Response<
                                                                                                                    A extends Adapter = Adapter,
                                                                                                                    M extends Message = Message,
                                                                                                                    R extends RegExpMatchArray | { [key: string]: string } = RegExpMatchArray
                                                                                                                    > {}

                                                                                                                      constructor

                                                                                                                      constructor(
                                                                                                                      robot: Robot<A>,
                                                                                                                      message: Message,
                                                                                                                      match: RegExpMatchArray | { [key: string]: string }
                                                                                                                      );

                                                                                                                        property envelope

                                                                                                                        envelope: Envelope;

                                                                                                                          property match

                                                                                                                          match: RegExpMatchArray | { [key: string]: string };

                                                                                                                            property message

                                                                                                                            message: Message;

                                                                                                                              property robot

                                                                                                                              robot: Robot<A>;

                                                                                                                                method emote

                                                                                                                                emote: (...strings: string[]) => void;

                                                                                                                                  method finish

                                                                                                                                  finish: () => void;

                                                                                                                                    method http

                                                                                                                                    http: (url: string, options?: HttpOptions) => ScopedClient;

                                                                                                                                      method locked

                                                                                                                                      locked: (...strings: string[]) => void;

                                                                                                                                        method play

                                                                                                                                        play: (...strings: string[]) => void;

                                                                                                                                          method random

                                                                                                                                          random: <T>(items: T[]) => T;

                                                                                                                                            method reply

                                                                                                                                            reply: (...strings: string[]) => void;

                                                                                                                                              method send

                                                                                                                                              send: (...strings: string[]) => void;

                                                                                                                                                method topic

                                                                                                                                                topic: (...strings: string[]) => void;

                                                                                                                                                  class Robot

                                                                                                                                                  class Robot<A extends Adapter = Adapter> {}

                                                                                                                                                    constructor

                                                                                                                                                    constructor(
                                                                                                                                                    adapterPath: string,
                                                                                                                                                    adapter: string,
                                                                                                                                                    httpd: boolean,
                                                                                                                                                    name: string,
                                                                                                                                                    alias?: string
                                                                                                                                                    );

                                                                                                                                                      property adapter

                                                                                                                                                      readonly adapter: Adapter;

                                                                                                                                                        property adapterName

                                                                                                                                                        readonly adapterName: string;

                                                                                                                                                          property adapterPath

                                                                                                                                                          readonly adapterPath: string;

                                                                                                                                                            property alias

                                                                                                                                                            readonly alias: string;

                                                                                                                                                              property brain

                                                                                                                                                              readonly brain: Brain<A>;

                                                                                                                                                                property commands

                                                                                                                                                                readonly commands: [];

                                                                                                                                                                  property datastore

                                                                                                                                                                  readonly datastore: DataStore;

                                                                                                                                                                    property errorHandlers

                                                                                                                                                                    readonly errorHandlers: [];

                                                                                                                                                                      property events

                                                                                                                                                                      readonly events: EventEmitter;

                                                                                                                                                                        property globalHttpOptions

                                                                                                                                                                        readonly globalHttpOptions: HttpOptions;

                                                                                                                                                                          property logger

                                                                                                                                                                          readonly logger: Log;

                                                                                                                                                                            property middleware

                                                                                                                                                                            readonly middleware: {
                                                                                                                                                                            listener: Middleware<A>;
                                                                                                                                                                            response: Middleware<A>;
                                                                                                                                                                            receive: Middleware<A>;
                                                                                                                                                                            };

                                                                                                                                                                              property name

                                                                                                                                                                              readonly name: string;

                                                                                                                                                                                property onUncaughtException

                                                                                                                                                                                readonly onUncaughtException: (err: Error) => void;

                                                                                                                                                                                  property pingIntervalId

                                                                                                                                                                                  readonly pingIntervalId: any;

                                                                                                                                                                                    property router

                                                                                                                                                                                    readonly router: Express;

                                                                                                                                                                                      property server

                                                                                                                                                                                      readonly server?: any;

                                                                                                                                                                                        property version

                                                                                                                                                                                        readonly version: string;

                                                                                                                                                                                          method catchAll

                                                                                                                                                                                          catchAll: {
                                                                                                                                                                                          (callback: ListenerCallback<A, CatchAllMessage>): void;
                                                                                                                                                                                          (options: {}, callback: ListenerCallback<A, CatchAllMessage>): void;
                                                                                                                                                                                          };

                                                                                                                                                                                            method emit

                                                                                                                                                                                            emit: (event: string | symbol, ...args: unknown[]) => void;

                                                                                                                                                                                              method enter

                                                                                                                                                                                              enter: {
                                                                                                                                                                                              (callback: ListenerCallback<A, EnterMessage>): void;
                                                                                                                                                                                              (options: {}, callback: ListenerCallback<A, EnterMessage>): void;
                                                                                                                                                                                              };

                                                                                                                                                                                                method error

                                                                                                                                                                                                error: (cb: (error: Error) => void) => void;

                                                                                                                                                                                                  method hear

                                                                                                                                                                                                  hear: {
                                                                                                                                                                                                  (regex: RegExp, callback: ListenerCallback<A, TextMessage>): void;
                                                                                                                                                                                                  (
                                                                                                                                                                                                  regex: RegExp,
                                                                                                                                                                                                  options: {},
                                                                                                                                                                                                  callback: ListenerCallback<A, TextMessage>
                                                                                                                                                                                                  ): void;
                                                                                                                                                                                                  };

                                                                                                                                                                                                    method helpCommands

                                                                                                                                                                                                    helpCommands: () => string[];

                                                                                                                                                                                                      method http

                                                                                                                                                                                                      http: (url: string, options?: HttpOptions) => ScopedClient;

                                                                                                                                                                                                        method leave

                                                                                                                                                                                                        leave: {
                                                                                                                                                                                                        (callback: ListenerCallback<A, LeaveMessage>): void;
                                                                                                                                                                                                        (options: {}, callback: ListenerCallback<A, LeaveMessage>): void;
                                                                                                                                                                                                        };

                                                                                                                                                                                                          method listen

                                                                                                                                                                                                          listen: {
                                                                                                                                                                                                          (
                                                                                                                                                                                                          matcher: (message: Message) => boolean,
                                                                                                                                                                                                          callback: ListenerCallback<A>
                                                                                                                                                                                                          ): void;
                                                                                                                                                                                                          (
                                                                                                                                                                                                          matcher: (message: Message) => boolean,
                                                                                                                                                                                                          options: {},
                                                                                                                                                                                                          callback: ListenerCallback<A, Message>
                                                                                                                                                                                                          ): void;
                                                                                                                                                                                                          };

                                                                                                                                                                                                            method listenerMiddleware

                                                                                                                                                                                                            listenerMiddleware: (middleware: MiddlewareHandler<A>) => void;

                                                                                                                                                                                                              method loadExternalScripts

                                                                                                                                                                                                              loadExternalScripts: (packages: string[]) => void;

                                                                                                                                                                                                                method loadFile

                                                                                                                                                                                                                loadFile: (directory: string, fileName: string) => void;

                                                                                                                                                                                                                  method loadHubotScripts

                                                                                                                                                                                                                  loadHubotScripts: (path: string, scripts: string[]) => void;

                                                                                                                                                                                                                    method messageRoom

                                                                                                                                                                                                                    messageRoom: (room: string, ...strings: string[]) => void;

                                                                                                                                                                                                                      method on

                                                                                                                                                                                                                      on: (event: string | symbol, listener: (...args: unknown[]) => void) => this;

                                                                                                                                                                                                                        method receive

                                                                                                                                                                                                                        receive: (message: Message, cb?: () => void) => void;

                                                                                                                                                                                                                          method receiveMiddleware

                                                                                                                                                                                                                          receiveMiddleware: (middleware: MiddlewareHandler<A>) => void;

                                                                                                                                                                                                                            method reply

                                                                                                                                                                                                                            reply: (envelope: Envelope, ...strings: string[]) => void;

                                                                                                                                                                                                                              method respond

                                                                                                                                                                                                                              respond: {
                                                                                                                                                                                                                              (regex: RegExp, callback: ListenerCallback<A, TextMessage>): void;
                                                                                                                                                                                                                              (
                                                                                                                                                                                                                              regex: RegExp,
                                                                                                                                                                                                                              options: {},
                                                                                                                                                                                                                              callback: ListenerCallback<A, TextMessage>
                                                                                                                                                                                                                              ): void;
                                                                                                                                                                                                                              };

                                                                                                                                                                                                                                method respondPattern

                                                                                                                                                                                                                                respondPattern: (regex: RegExp) => RegExp;

                                                                                                                                                                                                                                  method responseMiddleware

                                                                                                                                                                                                                                  responseMiddleware: (middleware: MiddlewareHandler<A>) => void;

                                                                                                                                                                                                                                    method run

                                                                                                                                                                                                                                    run: () => void;

                                                                                                                                                                                                                                      method send

                                                                                                                                                                                                                                      send: (envelope: Envelope, ...strings: string[]) => void;

                                                                                                                                                                                                                                        method shutdown

                                                                                                                                                                                                                                        shutdown: () => void;

                                                                                                                                                                                                                                          method topic

                                                                                                                                                                                                                                          topic: {
                                                                                                                                                                                                                                          (callback: ListenerCallback<A, TopicMessage>): void;
                                                                                                                                                                                                                                          (options: {}, callback: ListenerCallback<A, TopicMessage>): void;
                                                                                                                                                                                                                                          };

                                                                                                                                                                                                                                            class TextMessage

                                                                                                                                                                                                                                            class TextMessage extends Message {}

                                                                                                                                                                                                                                              constructor

                                                                                                                                                                                                                                              constructor(user: User, text: string, id: string);

                                                                                                                                                                                                                                                property text

                                                                                                                                                                                                                                                text: string;

                                                                                                                                                                                                                                                  method match

                                                                                                                                                                                                                                                  match: (regex: RegExp) => RegExpMatchArray;

                                                                                                                                                                                                                                                    method toString

                                                                                                                                                                                                                                                    toString: () => string;

                                                                                                                                                                                                                                                      class TopicMessage

                                                                                                                                                                                                                                                      class TopicMessage extends TextMessage {}

                                                                                                                                                                                                                                                        property text

                                                                                                                                                                                                                                                        text: string;

                                                                                                                                                                                                                                                          class User

                                                                                                                                                                                                                                                          class User {}

                                                                                                                                                                                                                                                            constructor

                                                                                                                                                                                                                                                            constructor(id: string, options?: {});

                                                                                                                                                                                                                                                              property id

                                                                                                                                                                                                                                                              id: string;

                                                                                                                                                                                                                                                                property name

                                                                                                                                                                                                                                                                name: string;

                                                                                                                                                                                                                                                                  method get

                                                                                                                                                                                                                                                                  get: (key: string) => any;

                                                                                                                                                                                                                                                                    method set

                                                                                                                                                                                                                                                                    set: (key: string, value: any) => this;

                                                                                                                                                                                                                                                                      Interfaces

                                                                                                                                                                                                                                                                      interface Envelope

                                                                                                                                                                                                                                                                      interface Envelope {}

                                                                                                                                                                                                                                                                        property message

                                                                                                                                                                                                                                                                        message: Message;

                                                                                                                                                                                                                                                                          property room

                                                                                                                                                                                                                                                                          room: string;

                                                                                                                                                                                                                                                                            property user

                                                                                                                                                                                                                                                                            user: User;

                                                                                                                                                                                                                                                                              interface Log

                                                                                                                                                                                                                                                                              interface Log {}

                                                                                                                                                                                                                                                                                property debug

                                                                                                                                                                                                                                                                                debug: LogLevel;

                                                                                                                                                                                                                                                                                  property error

                                                                                                                                                                                                                                                                                  error: LogLevel;

                                                                                                                                                                                                                                                                                    property info

                                                                                                                                                                                                                                                                                    info: LogLevel;

                                                                                                                                                                                                                                                                                      property notice

                                                                                                                                                                                                                                                                                      notice: LogLevel;

                                                                                                                                                                                                                                                                                        property warning

                                                                                                                                                                                                                                                                                        warning: LogLevel;

                                                                                                                                                                                                                                                                                          method get

                                                                                                                                                                                                                                                                                          get: (namespace: string) => Log;

                                                                                                                                                                                                                                                                                            call signature

                                                                                                                                                                                                                                                                                            (...messages: any[]): void;

                                                                                                                                                                                                                                                                                              interface LogLevel

                                                                                                                                                                                                                                                                                              interface LogLevel {}

                                                                                                                                                                                                                                                                                                method disable

                                                                                                                                                                                                                                                                                                disable: () => void;

                                                                                                                                                                                                                                                                                                  method enable

                                                                                                                                                                                                                                                                                                  enable: () => void;

                                                                                                                                                                                                                                                                                                    call signature

                                                                                                                                                                                                                                                                                                    (...messages: any[]): void;

                                                                                                                                                                                                                                                                                                      interface MiddlewareContext

                                                                                                                                                                                                                                                                                                      interface MiddlewareContext<T extends Adapter = Adapter> {}

                                                                                                                                                                                                                                                                                                        property response

                                                                                                                                                                                                                                                                                                        response?: Response<T> | undefined;

                                                                                                                                                                                                                                                                                                          index signature

                                                                                                                                                                                                                                                                                                          [key: string]: unknown;

                                                                                                                                                                                                                                                                                                            Type Aliases

                                                                                                                                                                                                                                                                                                            type DoneFunction

                                                                                                                                                                                                                                                                                                            type DoneFunction = () => void;

                                                                                                                                                                                                                                                                                                              type ListenerCallback

                                                                                                                                                                                                                                                                                                              type ListenerCallback<A extends Adapter = Adapter, M extends Message = Message> = (
                                                                                                                                                                                                                                                                                                              response: Response<A, M>
                                                                                                                                                                                                                                                                                                              ) => void;

                                                                                                                                                                                                                                                                                                                type MiddlewareHandler

                                                                                                                                                                                                                                                                                                                type MiddlewareHandler<T extends Adapter = Adapter> = (
                                                                                                                                                                                                                                                                                                                context: MiddlewareContext<T>,
                                                                                                                                                                                                                                                                                                                next: NextFunction,
                                                                                                                                                                                                                                                                                                                done: DoneFunction
                                                                                                                                                                                                                                                                                                                ) => void;

                                                                                                                                                                                                                                                                                                                  type NextFunction

                                                                                                                                                                                                                                                                                                                  type NextFunction = (done: DoneFunction) => void;

                                                                                                                                                                                                                                                                                                                    Package Files (1)

                                                                                                                                                                                                                                                                                                                    Dependencies (3)

                                                                                                                                                                                                                                                                                                                    Dev Dependencies (0)

                                                                                                                                                                                                                                                                                                                    No dev dependencies.

                                                                                                                                                                                                                                                                                                                    Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                                    No peer dependencies.

                                                                                                                                                                                                                                                                                                                    Badge

                                                                                                                                                                                                                                                                                                                    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                                    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/hubot.

                                                                                                                                                                                                                                                                                                                    • Markdown
                                                                                                                                                                                                                                                                                                                      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/hubot)
                                                                                                                                                                                                                                                                                                                    • HTML
                                                                                                                                                                                                                                                                                                                      <a href="https://www.jsdocs.io/package/@types/hubot"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>