go-telegram/bot

LinkPreviewOptions problem

Closed this issue · 2 comments

In the previous version, I used DisableWebPagePreview: true when creating SendMessageParam. and it worked great.
Now, with the new version this is replaced with LinkPreviewOptions and when I add &models.LinkPreviewOptions{IsDisabled: &linkPreviewDisabled} I got message {"ok":false,"error_code":400,"description":"Bad Request: field \"url\" must be of type String"}.
So I added random text like this LinkPreviewOptions: &models.LinkPreviewOptions{URL: &testURL, IsDisabled: &linkPreviewDisabled}, and it worked.

The problem is why I need to specify some URLs and set them here when I want to disable URL previews. Is there an option to add a check if IsDisabled=true then no URL is required?

Released v1.0.1 with fix.
Now

	b.SendMessage(ctx, &bot.SendMessageParams{
		ChatID: update.Message.Chat.ID,
		Text:   "Hello, https://pinterest.com",
		LinkPreviewOptions: &models.LinkPreviewOptions{
			IsDisabled: bot.False(),
		},
	})

works correctly

Thanks so much for a quick fix.
Wish you the best.