@@ -14,7 +14,7 @@ const bot = new TelegramBot(TOKEN, options);
1414
1515
1616// Matches /photo
17- bot . onText ( / ^ \/ p h o t o / , function onPhotoText ( msg ) {
17+ bot . onText ( / ^ \/ p h o t o ( @ . * | $ ) / , function onPhotoText ( msg ) {
1818 // From file path
1919 const photo = `${ __dirname } /../test/data/photo.gif` ;
2020 bot . sendPhoto ( msg . chat . id , photo , {
@@ -24,7 +24,7 @@ bot.onText(/^\/photo/, function onPhotoText(msg) {
2424
2525
2626// Matches /audio
27- bot . onText ( / ^ \/ a u d i o / , function onAudioText ( msg ) {
27+ bot . onText ( / ^ \/ a u d i o ( @ . * | $ ) / , function onAudioText ( msg ) {
2828 // From HTTP request
2929 const url = 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg' ;
3030 const audio = request ( url ) ;
@@ -33,7 +33,7 @@ bot.onText(/^\/audio/, function onAudioText(msg) {
3333
3434
3535// Matches /love
36- bot . onText ( / ^ \/ l o v e / , function onLoveText ( msg ) {
36+ bot . onText ( / ^ \/ l o v e ( @ . * | $ ) / , function onLoveText ( msg ) {
3737 const opts = {
3838 reply_to_message_id : msg . message_id ,
3939 reply_markup : JSON . stringify ( {
@@ -48,14 +48,14 @@ bot.onText(/^\/love/, function onLoveText(msg) {
4848
4949
5050// Matches /echo [whatever]
51- bot . onText ( / ^ \/ e c h o ( .+ ) / , function onEchoText ( msg , match ) {
51+ bot . onText ( / ^ \/ e c h o (?: @ . * ? ) ? ( .+ ) / , function onEchoText ( msg , match ) {
5252 const resp = match [ 1 ] ;
5353 bot . sendMessage ( msg . chat . id , resp ) ;
5454} ) ;
5555
5656
5757// Matches /editable
58- bot . onText ( / ^ \/ e d i t a b l e / , function onEditableText ( msg ) {
58+ bot . onText ( / ^ \/ e d i t a b l e ( @ . * | $ ) / , function onEditableText ( msg ) {
5959 const opts = {
6060 reply_markup : {
6161 inline_keyboard : [
0 commit comments