How to get message ID when replying to a message?
Opened this issue · 2 comments
I have a method that listens to on-message
and I want to get the *current-message*
ID so that I can pass it to reply
as reply-message-id
, but *current-message*
is not an exported symbol. Is that something we can export? Or maybe pass an instance of the message
class to on-message
? Or any other suggestions?
Do you want to call reply
but later?
I'm looked into the code and sems exporting of *current-message*
will not be sufficient.
Describe your use-case and I'll think how it is better to adopt the API.
Thanks for your quick response! With reply
if I want to pass the reply-to-message-id
parameter, I can't because I don't have the message ID. And I need a message ID to send a message via cl-telegram-bot/message:send-message
too. My use case is simple, I want to quote the user's original text when replying to it.
For example, in the below snippet I want to have the value of some-imaginary-id
which is the ID of the message that has the text text
.
(defmethod cl-telegram-bot:on-message ((cl-telegram-bot/bot:bot bot) text)
(reply text :reply-to-message-id some-imaginary-id))
Ideally, it would be great if the message
is passed along like this:
(defgeneric on-message (bot message)
(:documentation "This method gets called with the message.
By default it does nothing."))
Rather than
(defgeneric on-message (bot text)
(:documentation "This method gets called with raw text from the message.
By default it does nothing."))
This would allow us to access all the slots of the message
object, not just its id
.