Feat(telegram): Update help & show to include raw & body
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good

This commit is contained in:
2022-09-13 23:43:03 +08:00
parent 0d38e24b3e
commit 2a7cad131e

View File

@@ -56,7 +56,7 @@ func (env *Env) registerWebhookBody(shortCode string, text string) (bool, *strin
func (env *Env) displayHelp(shortCode string, text string) (bool, *string) {
commandSplitted := telegrampackage.ParseTelegramBotCommand(text)
if len(commandSplitted) > 0 && commandSplitted[0] == "/help" {
responseText := "/register -> Register for a chat ID\n/register_webhook -> Register for a web hook\n/show -> Show existing webhooks"
responseText := "/register -> Register for a chat ID\n/register_webhook_raw -> Register for a web hook for raw requests\n/register_webhook_body -> Register for a web hook for requests body\n/show -> Show existing webhooks"
return true, &responseText
}
return false, nil
@@ -74,7 +74,7 @@ func (env *Env) showRoutes(shortCode string, text string) (bool, *string) {
baseURL.Path = path.Join(baseURL.Path, "routes")
baseURL.Path = path.Join(baseURL.Path, curr.WebhookID)
webhookURL := baseURL.String()
responseText += fmt.Sprintf("%s\n", webhookURL)
responseText += fmt.Sprintf("%s (%s)\n", webhookURL, curr.WebhookType)
}
return true, &responseText
}