@@ -66,15 +66,28 @@ func InitializeTelegramEndpoint(token string, exitChan <-chan struct{}, database
6666 e .commands = map [string ]handlerWithDescription {
6767 "/new" : {
6868 f : e .handlerNew ,
69- description : "`/new repo filter_name filter_regexp` -- creates new available subscription" ,
69+ description : "`/new repo filter_name filter_regexp` -- creates new available subscription" + `
70+
71+ Example:
72+ ` + "`/new lomik/go-carbon all ^V`" + `
73+
74+ This will create repo named 'lomik/go-carbon', with filter called 'all' and regexp that will grab all tags that starts from capital 'V'` ,
7075 },
7176 "/subscribe" : {
7277 f : e .handlerSubscribe ,
73- description : "`/subscribe repo filter_name` -- subscribe current channel to specific repo and filter" ,
78+ description : "`/subscribe repo filter_name` -- subscribe current channel to specific repo and filter" + `
79+
80+ Example:
81+ ` + "`/subscribe lomik/go-carbon all`" + `
82+ ` ,
7483 },
7584 "/unsubscribe" : {
7685 f : e .handlerUnsubscribe ,
77- description : "`/unsubscribe repo filter_name` -- unsubscribe current channel to specific repo and filter" ,
86+ description : "`/unsubscribe repo filter_name` -- unsubscribe current channel to specific repo and filter" + `
87+
88+ Example:
89+ ` + "`/unsubscribe lomik/go-carbon all`" + `
90+ ` ,
7891 },
7992 "/list" : {
8093 f : e .handlerList ,
@@ -156,7 +169,7 @@ func (e *TelegramEndpoint) handlerNew(tokens []string, update *tgbotapi.Update)
156169 return errUnauthorized
157170 }
158171 if len (tokens ) < 4 {
159- return errors .New ("Not enough arguments\n \n Usage: /new repo_name filter_name filter_regex [message_pattern (will replace first '%s' with feed name]" )
172+ return errors .New ("Command require exactly 4 arguments\n \n " + e . commands [ "/new" ]. description )
160173 }
161174
162175 repo := tokens [1 ]
@@ -208,7 +221,7 @@ func (e *TelegramEndpoint) handlerSubscribe(tokens []string, update *tgbotapi.Up
208221 }
209222
210223 if len (tokens ) != 3 {
211- return errors .New ("/subscribe requires exactly 2 arguments" )
224+ return errors .New ("/subscribe requires exactly 2 arguments. \n \n " + e . commands [ "/subscribe" ]. description )
212225 }
213226
214227 url := tokens [1 ]
@@ -248,7 +261,7 @@ func (e *TelegramEndpoint) handlerUnsubscribe(tokens []string, update *tgbotapi.
248261 }
249262
250263 if len (tokens ) != 3 {
251- return errors .New ("/unsubscribe requires exactly 3 arguments" )
264+ return errors .New ("/unsubscribe requires exactly 2 arguments\n \n " + e . commands [ "/unsubscribe" ]. description )
252265 }
253266
254267 url := tokens [1 ]
@@ -295,7 +308,7 @@ func (e *TelegramEndpoint) handlerList(tokens []string, update *tgbotapi.Update)
295308func (e * TelegramEndpoint ) handlerHelp (tokens []string , update * tgbotapi.Update ) error {
296309 response := ""
297310 for _ , v := range e .commands {
298- response = response + v .description + "\n "
311+ response = response + v .description + "\n \n ============================== \n \n "
299312 }
300313
301314 e .sendMessage (update .Message .Chat .ID , update .Message .MessageID , response )
0 commit comments