Skip to content

feat(send.options): added a reply option into the sender functions to quote a message#2

Merged
j05u3 merged 1 commit intoj05u3:mainfrom
Luisotee:dev
Oct 2, 2023
Merged

feat(send.options): added a reply option into the sender functions to quote a message#2
j05u3 merged 1 commit intoj05u3:mainfrom
Luisotee:dev

Conversation

@Luisotee
Copy link
Copy Markdown
Contributor

@Luisotee Luisotee commented Oct 2, 2023

I added a method to be able to quote messages when answering them:

image

Examples of usage:

Basically you just need to add a reply: message.id to the options object.

sender.sendText(message.from, "Hello World", { reply: message.id });
  sender.sendImage(message.from, "https://i.imgur.com/2bYg0kc.jpeg", {
    reply: message.id,
  });
  sender.sendDocument(
    message.from,
    "https://www.cnabrasil.org.br/assets/arquivos/Balanca-Comercial_jan-dez-2020.pdf",
    {
      caption: "Balança agronegocio",
      filename: "Balanca-Comercial_jan",
      reply: message.id,
    }
  );
  sender.sendAudio(
    message.from,
    "https://actions.google.com/sounds/v1/alarms/digital_watch_alarm_long.ogg",
    {
      reply: message.id,
    }
  );
  sender.sendVideo(
    message.from,
    "https://media0.giphy.com/media/v1.Y2lkPTc5MGI3NjExa2o0aTQ1NW5xeWV0dG90eHpmOGRzNnYxNWtlcmg0bGJocnVkZHNmZSZlcD12MV9pbnRlcm5hbF9naWZfYnlfaWQmY3Q9Zw/gw3IWyGkC0rsazTi/giphy.mp4",
    {
      reply: message.id,
      caption: "Video",
    }
  );
  sender.sendSticker(
    message.from,
    "https://img-06.stickers.cloud/packs/5df297e3-a7f0-44e0-a6d1-43bdb09b793c/webp/8709a42d-0579-4314-b659-9c2cdb979305.webp",
    {
      reply: message.id,
    }
    
    
const options = {
    footerText: "O que você deseja fazer com sua obra?",
    reply: message.id,
  };
await sender.sendList(message.from, buttonName, bodyText, sections, options);

Description of change

Pull-Request Checklist

  • Code is up-to-date with the main branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions outlined in the conventional commit spec

@j05u3
Copy link
Copy Markdown
Owner

j05u3 commented Oct 2, 2023

awesome, will merge now

and btw, maybe in the future we can have an interface maybe called something like NonTemplateMessage that extends Message and has this context parameter? 🤔, this way we can make the AudioMessage, TextMessage, ... extend NonTemplateMessage, what do you think?

@j05u3 j05u3 merged commit dd1746a into j05u3:main Oct 2, 2023
@github-actions
Copy link
Copy Markdown

github-actions bot commented Oct 2, 2023

🎉 This PR is included in version 2.6.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants