Options
All
  • Public
  • Public/Protected
  • All
Menu

This class supports the functionality of the AINFT factory for seamless use on Discord.
Do not create it directly; Get it from AinftJs instance.

Hierarchy

Index

Constructors

  • new Discord(baseUrl: string, route: null | string, ain: default, ainize?: default): Discord

Properties

ain: default

The Ain object for sign and send transaction to AIN blockchain.

ainize?: default

The Ainize object for send request to AIN blockchain.

baseUrl: string = ''

The base url of api server of AINFT Factory.

route: string

The subpath of api server request url.

Methods

  • addInviteInfo(appId: string, eventId: string, taskInstanceId: string, inviteeId: string, inviterId?: string, ambiguousInviters?: string[]): Promise<void>
  • You can add new user's invitation information.

    Parameters

    • appId: string

      The ID of app.

    • eventId: string

      The ID of invitation event.

    • taskInstanceId: string

      The ID of invitation event's task.

    • inviteeId: string

      The ID of invitee.

    • Optional inviterId: string

      The ID of inviter. If you can't identify the inviter, leave blank this.

    • Optional ambiguousInviters: string[]

      Array of userIds invited in a short time.

    Returns Promise<void>

    Return InviteInfo object.

  • addPersonaModelToDiscordChannel(appId: string, modelId: string, modelName: string, discordGuildId: string, discordChannelId: string): Promise<void>
  • Adds persona model to discord channel.

    Parameters

    • appId: string

      The ID of app.

    • modelId: string

      The ID of persona model.

    • modelName: string

      The name of persona model.

    • discordGuildId: string

      The discord guild ID to which the model will be linked.

    • discordChannelId: string

      The discord channel ID to which the model will be linked.

    Returns Promise<void>

  • connectDiscordWithApp(appId: string, discordGuildId: string): Promise<void>
  • Connects discord server and AINFT Factory app. A Discord server can only connect to one app.

    Parameters

    • appId: string

      The ID of app.

    • discordGuildId: string

      The discord guild ID to which app will be linked.

    Returns Promise<void>

  • deletePersonaModelFromDiscordChannel(appId: string, discordGuildId: string, discordChannelId: string): Promise<void>
  • Disconnects persona model with discord channel.

    Parameters

    • appId: string

      The ID of app.

    • discordGuildId: string

      The discord guild ID to which the model will be disconnected.

    • discordChannelId: string

      The discord channel ID to which the model will be disconnected.

    Returns Promise<void>

  • getConnectedApp(discordGuildId: string, appId?: string): Promise<null | string>
  • Gets the appId connected with the Discord guild.

    Parameters

    • discordGuildId: string

      The ID of discord guild.

    • appId: string = ''

      The ID of app.

    Returns Promise<null | string>

    Returns connected app Id or null.

  • getConnectedEventsByServer(appId: string, discordGuildId: string): Promise<(null | EventInfo)[]>
  • Get event list connected with the Discord server

    Parameters

    • appId: string

      The ID of app.

    • discordGuildId: string

      The ID of discord guild.

    Returns Promise<(null | EventInfo)[]>

    Returns event list connected discord guild.

  • getConnectedTasksByChannel(appId: string, discordGuildId: string, discordChannelId: string): Promise<TaskIdListByEventId>
  • Gets tasks connected with discord channel

    Parameters

    • appId: string

      The ID of app.

    • discordGuildId: string

      The ID of discord guild.

    • discordChannelId: string

      The ID of discord channel.

    Returns Promise<TaskIdListByEventId>

    Returns a map of task IDs for each event ID.

  • getInviteInfo(appId: string, discordGuildId: string, inviteeId: string): Promise<InviteInfo>
  • You can get user's invitation information.

    Parameters

    • appId: string

      The ID of app.

    • discordGuildId: string

      The ID of discord guild.

    • inviteeId: string

      The ID of invitee.

    Returns Promise<InviteInfo>

    Return InviteInfo object.

  • getPersonaModelForDiscordChannel(appId: string, discordGuildId: string, discordChannelId: string): Promise<null | ChannelPersonaModelInfo>
  • Gets persona model connected with discord channel.

    Parameters

    • appId: string

      The ID of app.

    • discordGuildId: string

      The discord guild ID to which model was connected.

    • discordChannelId: string

      The discord channel ID to which model was connected.

    Returns Promise<null | ChannelPersonaModelInfo>

  • getPersonaModelForDiscordServer(appId: string, discordGuildId: string): Promise<null | ServerPersonaModelInfo>
  • Gets persona models connected with discord server.

    Parameters

    • appId: string

      The ID of app.

    • discordGuildId: string

      The discord build ID to which model was connected.

    Returns Promise<null | ServerPersonaModelInfo>

    Returns a Map of information about the models linked to each channel in the guild."

  • sendFormRequest(method: POST | PUT, trailingUrl: string, stringFields: {}, fileFields: {}): Promise<any>
  • Sends request that include form to api server of AINFT Factory. Used to upload asset data.

    Parameters

    • method: POST | PUT

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • stringFields: {}

      The string fields of form.

      • [key: string]: string
    • fileFields: {}

      The file fields of form.

      • [key: string]: { buffer: Buffer; filename: string }
        • buffer: Buffer
        • filename: string

    Returns Promise<any>

    Returns response of api request.

  • sendRequest(method: HttpMethod, trailingUrl: string, data?: Record<string, any>): Promise<any>
  • Sends request to api server of AINFT Factory. Authenticate by signing data.

    Parameters

    • method: HttpMethod

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • Optional data: Record<string, any>

      The data to be included in the api request.

    Returns Promise<any>

    Returns response of api request.

  • sendRequestWithoutSign(method: HttpMethod, trailingUrl: string, data?: Record<string, any>, headers?: AxiosRequestHeaders): Promise<any>
  • Sends request to api server of AINFT Factory. Used when authentication is not required.

    Parameters

    • method: HttpMethod

      The method of Http request.

    • trailingUrl: string

      The suffix of request url.

    • Optional data: Record<string, any>

      The data to be included in the api request.

    • Optional headers: AxiosRequestHeaders

      The headers of Http api request.

    Returns Promise<any>

    Returns response of api request.

  • setBaseUrl(baseUrl: string): void
  • signData(data: any): string | Promise<string>
  • Sign the data with the private key that the user has registered.

    Parameters

    • data: any

      The data to sign.

    Returns string | Promise<string>

    Returns signature string.

Generated using TypeDoc