Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What is the best way to delete a message? #514

Closed
Algalish opened this issue Jan 24, 2022 · 1 comment
Closed

What is the best way to delete a message? #514

Algalish opened this issue Jan 24, 2022 · 1 comment

Comments

@Algalish
Copy link

When I do this I get an error BUT the message is deleted correctly.
Thx!

msgToDelete := tgbotapi.DeleteMessageConfig{
		ChatID:    chatID,
		MessageID: msgID,
	}

_, err := TelegramBot.Send(msgToDelete)
@Syfaro
Copy link
Member

Syfaro commented Jan 24, 2022

Hi,

The Send method should be used for endpoints that return messages, the Request method should be used for endpoints that don't return meaningful data, such as deleteMessage.

msgToDelete := tgbotapi.DeleteMessageConfig{
	ChatID:    chatID,
	MessageID: msgID,
}

_, err := TelegramBot.Request(msgToDelete)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants