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
  • Loading branch information
echo-devim committed Oct 29, 2024
1 parent e7ba972 commit 9e78038
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 @@ -664,8 +664,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);

Check failure on line 668 in src/AsyncTelegram2.cpp

View workflow job for this annotation

GitHub Actions / build

[cpplint] reported by reviewdog 🐶 Lines should be <= 100 characters long [whitespace/line_length] [2] Raw Output: src/AsyncTelegram2.cpp:668: Lines should be <= 100 characters long [whitespace/line_length] [2]
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);

Check failure on line 672 in src/AsyncTelegram2.cpp

View workflow job for this annotation

GitHub Actions / build

[cpplint] reported by reviewdog 🐶 Lines should be <= 100 characters long [whitespace/line_length] [2] Raw Output: src/AsyncTelegram2.cpp:672: Lines should be <= 100 characters long [whitespace/line_length] [2]
}

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 9e78038

Please sign in to comment.