Fix(chat-id): Handling unregistered chat ID
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good
All checks were successful
Webhook-Everything/Webhook-Everything/pipeline/head This commit looks good
This commit is contained in:
@@ -104,6 +104,15 @@ func (env *Env) TelegramListenAndGen() error {
|
||||
fmt.Println(err)
|
||||
}
|
||||
|
||||
if chatIDMap.ChatIDShort == "" {
|
||||
msg := tgbotapi.NewMessage(update.Message.Chat.ID, "Please send /register to register for a chat ID")
|
||||
_, err := bot.Send(msg)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
var handled = false
|
||||
for _, currFunc := range env.HandlerFunctions {
|
||||
currHandled, responseText := currFunc(chatIDMap.ChatIDShort, update.Message.Text)
|
||||
|
||||
@@ -67,7 +67,7 @@ func (env *Env) showRoutes(shortCode string, text string) (bool, *string) {
|
||||
if len(commandSplitted) > 0 && commandSplitted[0] == "/show" {
|
||||
var results []WebhookRoute
|
||||
env.DB.Where(&WebhookRoute{TelegramShortCode: shortCode}).Find(&results)
|
||||
responseText := "The following webhook URLs were previously registered:"
|
||||
responseText := "The following webhook URLs were previously registered: "
|
||||
for _, curr := range results {
|
||||
baseURL, _ := url.Parse(env.HostURL)
|
||||
baseURL.Path = path.Join(baseURL.Path, "webhook")
|
||||
|
||||
Reference in New Issue
Block a user