Skip to content

Commit

Permalink
Added support to mimetypes TEXT and BINARY, fixed missing VOICE strea…
Browse files Browse the repository at this point in the history
…m type (#145)
  • Loading branch information
echo-devim authored Oct 30, 2024
1 parent 71243d4 commit 47cb06c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/AsyncTelegram2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,12 @@ bool AsyncTelegram2::sendDocument(int64_t chat_id, Stream &stream, size_t size,
return sendStream(chat_id, "sendPhoto", "image/jpeg", "photo", stream, size, filename, caption);
case AUDIO:
return sendStream(chat_id, "sendDocument", "audio/mp3", "audio", stream, size, filename, caption);
default:
case VOICE:
return sendStream(chat_id, "sendVoice", "audio/ogg", "voice", stream, size, filename, caption);
case TEXT:
return sendStream(chat_id, "sendDocument", "text/plain", "document", stream, size, filename, caption);
default: // BINARY
return sendStream(chat_id, "sendDocument", "application/octet-stream", "document", stream, size, filename, caption);
}

return false;
Expand Down
4 changes: 3 additions & 1 deletion src/AsyncTelegram2.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ class AsyncTelegram2
VOICE,
VIDEO,
CSV,
JSON
JSON,
TEXT,
BINARY
};
bool sendDocument(int64_t chat_id, Stream &stream, size_t size,
DocumentType doc, const char *filename, const char *caption = nullptr);
Expand Down

0 comments on commit 47cb06c

Please sign in to comment.