@@ -14,7 +14,7 @@ const bot = new TelegramBot(TOKEN, options);
14
14
15
15
16
16
// Matches /photo
17
- bot . onText ( / ^ \/ p h o t o / , function onPhotoText ( msg ) {
17
+ bot . onText ( / ^ \/ p h o t o ( @ . * | $ ) / , function onPhotoText ( msg ) {
18
18
// From file path
19
19
const photo = `${ __dirname } /../test/data/photo.gif` ;
20
20
bot . sendPhoto ( msg . chat . id , photo , {
@@ -24,7 +24,7 @@ bot.onText(/^\/photo/, function onPhotoText(msg) {
24
24
25
25
26
26
// Matches /audio
27
- bot . onText ( / ^ \/ a u d i o / , function onAudioText ( msg ) {
27
+ bot . onText ( / ^ \/ a u d i o ( @ . * | $ ) / , function onAudioText ( msg ) {
28
28
// From HTTP request
29
29
const url = 'https://upload.wikimedia.org/wikipedia/commons/c/c8/Example.ogg' ;
30
30
const audio = request ( url ) ;
@@ -33,7 +33,7 @@ bot.onText(/^\/audio/, function onAudioText(msg) {
33
33
34
34
35
35
// Matches /love
36
- bot . onText ( / ^ \/ l o v e / , function onLoveText ( msg ) {
36
+ bot . onText ( / ^ \/ l o v e ( @ . * | $ ) / , function onLoveText ( msg ) {
37
37
const opts = {
38
38
reply_to_message_id : msg . message_id ,
39
39
reply_markup : JSON . stringify ( {
@@ -48,14 +48,14 @@ bot.onText(/^\/love/, function onLoveText(msg) {
48
48
49
49
50
50
// 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 ) {
52
52
const resp = match [ 1 ] ;
53
53
bot . sendMessage ( msg . chat . id , resp ) ;
54
54
} ) ;
55
55
56
56
57
57
// 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 ) {
59
59
const opts = {
60
60
reply_markup : {
61
61
inline_keyboard : [
0 commit comments