Don't register VoiceNote and VideoNote messages for bots.

This commit is contained in:
levlam 2022-11-12 10:51:57 +03:00
parent f43956f25d
commit 1d672470ea
2 changed files with 9 additions and 4 deletions

View File

@ -171,7 +171,8 @@ void VideoNotesManager::create_video_note(FileId file_id, string minithumbnail,
void VideoNotesManager::register_video_note(FileId video_note_file_id, FullMessageId full_message_id,
const char *source) {
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server()) {
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server() ||
td_->auth_manager_->is_bot()) {
return;
}
LOG(INFO) << "Register video note " << video_note_file_id << " from " << full_message_id << " from " << source;
@ -183,7 +184,8 @@ void VideoNotesManager::register_video_note(FileId video_note_file_id, FullMessa
void VideoNotesManager::unregister_video_note(FileId video_note_file_id, FullMessageId full_message_id,
const char *source) {
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server()) {
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server() ||
td_->auth_manager_->is_bot()) {
return;
}
LOG(INFO) << "Unregister video note " << video_note_file_id << " from " << full_message_id << " from " << source;

View File

@ -6,6 +6,7 @@
//
#include "td/telegram/VoiceNotesManager.h"
#include "td/telegram/AuthManager.h"
#include "td/telegram/Dimensions.h"
#include "td/telegram/files/FileManager.h"
#include "td/telegram/Global.h"
@ -134,7 +135,8 @@ void VoiceNotesManager::create_voice_note(FileId file_id, string mime_type, int3
void VoiceNotesManager::register_voice_note(FileId voice_note_file_id, FullMessageId full_message_id,
const char *source) {
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server()) {
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server() ||
td_->auth_manager_->is_bot()) {
return;
}
LOG(INFO) << "Register voice note " << voice_note_file_id << " from " << full_message_id << " from " << source;
@ -146,7 +148,8 @@ void VoiceNotesManager::register_voice_note(FileId voice_note_file_id, FullMessa
void VoiceNotesManager::unregister_voice_note(FileId voice_note_file_id, FullMessageId full_message_id,
const char *source) {
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server()) {
if (full_message_id.get_message_id().is_scheduled() || !full_message_id.get_message_id().is_server() ||
td_->auth_manager_->is_bot()) {
return;
}
LOG(INFO) << "Unregister voice note " << voice_note_file_id << " from " << full_message_id << " from " << source;