mirror of
https://github.com/QuasarApp/qTbot.git
synced 2025-05-07 02:39:36 +00:00
ffx files downloads
This commit is contained in:
parent
41a21cc90f
commit
79b33b3995
src
@ -21,21 +21,22 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
qTbot::TelegramRestBot bot;
|
||||
|
||||
QObject::connect(&bot, &qTbot::TelegramRestBot::sigReceiveMessage, [&bot](auto){
|
||||
QList<QSharedPointer<qTbot::iFile> > filesStack;
|
||||
QObject::connect(&bot, &qTbot::TelegramRestBot::sigReceiveMessage, [&bot, &filesStack](auto){
|
||||
while(auto&& msg = bot.takeNextUnreadMessage()) {
|
||||
|
||||
if (auto&& tmsg = msg.dynamicCast<qTbot::TelegramMsg>()) {
|
||||
|
||||
if (tmsg->contains(tmsg->Document)) {
|
||||
bot.getFile(tmsg->documents()->fileId(), qTbot::iFile::Local);
|
||||
filesStack.push_back(bot.getFile(tmsg->documents()->fileId(), qTbot::iFile::Local));
|
||||
}
|
||||
|
||||
if (tmsg->contains(tmsg->Image)) {
|
||||
bot.getFile(tmsg->image()->fileId(), qTbot::iFile::Local);
|
||||
filesStack.push_back(bot.getFile(tmsg->image()->fileId(), qTbot::iFile::Local));
|
||||
}
|
||||
|
||||
if (tmsg->contains(tmsg->Audio)) {
|
||||
bot.getFile(tmsg->audio()->fileId(), qTbot::iFile::Local);
|
||||
filesStack.push_back(bot.getFile(tmsg->audio()->fileId(), qTbot::iFile::Local));
|
||||
}
|
||||
|
||||
bot.sendSpecificMessage(tmsg->chatId(), "I see it - я вижу это", tmsg->messageId());
|
||||
|
@ -76,6 +76,7 @@ public:
|
||||
bool disableWebPagePreview = false);
|
||||
|
||||
|
||||
[[nodiscard("do not forget to save shared pointer of file handler, because it's will not save inner bot object.")]]
|
||||
QSharedPointer<iFile> getFile(const QString& fileId, iFile::Type fileType = iFile::Type::Ram) override;
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user