Closed suntong closed 3 years ago
Ah, to make it simple, Is there any builtin helper to remove the "type":"mention"
portion from the command? So /help
and /help @botname
becomes the same, and
@botname /do with parameters
become easy to handle?
Hey @suntong, thanks for the feedback. I'll look into this.
Meanwhile, if you have an existing working implementation, make a pull request and we'll work on it together from there.
I haven't touched the node/bot/js since then, and now while I'm re-reading what I wrote, I've lost the context why my proposed way is better, :) I think it is the difficulties on using the API, but I've lost all my memory on this matter, since I had never been a js/node programmer. Anyway, if I am to revisit the topic, I'll see if I can send in a PR -- previously I wasn't even sure if the idea is acceptable or not... :-)
Hi All,
When sending commands to bots, there are two cases -
message.text='/start'
)message.text='/start @bot_id'
)In both case, the
part will be the same (for the
/start
command; however, themessage.text
part will be different, with the @bot in group containing that @ mention part, which pointed out by{"offset":7,"length":12,"type":"mention"}
.In summary, bot command can be of the form
/help
or/help @botname
inmessage.text
. Is there any builtin helper to ease command writing that, I can easily do, saymessage.bot_command === "/help"
, that can cover both above two cases?thx