Skip to content

does not work with async / await #14

Description

@jwickens

the following code does not work because it sees it as a promise waiting for fulfill to resolve, so nothing happens.

  image: { // send an image
    controller: async (params, next) => {
      // remove tag from current message and wait for it to be sent
      await next(null, '')
      // now send image
      let url
      if (params.content.startsWith('http')) {
        url = params.content
      } else {
        url = urlBase + params.content
      }
      const message = params.bot.createOutgoingMessageFor(params.update.sender.id)
      message.addAttachmentFromUrl('image', url)
      params.bot.sendMessage(message)
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions