Skip to content

How to send a message back to the user with Abilities Bot ? #1002

Closed Answered by addo47
isnikulin asked this question in Q&A
Discussion options

You must be logged in to vote

Hey! Glad you're using the AbilityBot API. The ExampleBots repo is hella old and things have changed a bit here and there. The MessageSender is supposed to be a replica of the DefaultAbsMethod methods, so that's why the easy-access send method has been removed.

HOWEVER

AbilityBot has a utility message sender called SilentSender. That class has a send method that you can leverage. However, no errors will be thrown. If the method fails, it will return an empty optional.

Here's how you can send a message inside the action lambda:

MessageSender

sender.execute(new SendMessage().setChatId(ctx.getChatId()).setText("Hello World!"));

SilentSender

silent.send("Hello World!", ctx.getChatId());

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@isnikulin
Comment options

@addo47
Comment options

Answer selected by isnikulin
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants