File tree Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Expand file tree Collapse file tree 2 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,19 @@ const ora = require('ora');
55const parseChunk = require ( './src/utils/parseChunk' ) ;
66const { printError } = require ( './src/utils/print' ) ;
77
8+ const questions = [
9+ {
10+ type : 'input' ,
11+ message : 'Enter your botToken:' ,
12+ name : 'botToken' ,
13+ } ,
14+ {
15+ type : 'input' ,
16+ message : 'Enter channel\'s username (without @):' ,
17+ name : 'channelUsername' ,
18+ } ,
19+ ] ;
20+
821const handleAnswers = ( answers ) => {
922 const { botToken, channelUsername } = answers ;
1023 const url = `https://api.telegram.org/bot${ botToken } /getChat?chat_id=@${ channelUsername } ` ;
@@ -31,17 +44,6 @@ const handleError = (error) => {
3144} ;
3245
3346inquirer
34- . prompt ( [
35- {
36- type : 'input' ,
37- message : 'Enter your botToken:' ,
38- name : 'botToken' ,
39- } ,
40- {
41- type : 'input' ,
42- message : 'Enter channel\'s username (without @):' ,
43- name : 'channelUsername' ,
44- } ,
45- ] )
47+ . prompt ( questions )
4648 . then ( handleAnswers )
4749 . catch ( handleError ) ;
Original file line number Diff line number Diff line change @@ -6,7 +6,8 @@ const printWarning = (text) => console.warn(
66) ;
77
88const printError = ( text ) => console . error (
9- '\x1b[31m' , 'Invalid botToken or channel username provided!' ,
9+ '\x1b[33m' , 'express-notify-telegram ==>' ,
10+ '\x1b[31m' , text ,
1011) ;
1112
1213module . exports = { printWarning, printError } ;
You can’t perform that action at this time.
0 commit comments