wppconnect-team / WPP4Delphi

WPP4Delphi is an open-source project with the aim of exporting functions from WhatsApp Web for Delphi, which can be used to support the creation of any interaction.
Apache License 2.0
187 stars 61 forks source link

TWPPConnect.Config.ReceiveAttachmentAuto #66

Closed kayaliabd closed 5 months ago

kayaliabd commented 6 months ago

I think you deploy this property to allow auto saving of all media files attached in messages
and save those files on the path of TWPPConnect.Config.ReceiveAttachmentPath

I try it but it didn't work as expected!

marcelo386 commented 5 months ago
          // Treating the type of file received and downloading it to the folder \temp
          case AnsiIndexStr(UpperCase(AMessage.&type), ['PTT', 'IMAGE', 'VIDEO', 'AUDIO', 'DOCUMENT', 'STICKER', 'PTV']) of
            0: Extensao_Documento := 'mp3';
            1: Extensao_Documento := 'jpg';
            2: Extensao_Documento := 'mp4';
            3: Extensao_Documento := 'mp3';
            4:
            begin
              Extensao_Documento := ExtractFileExt(AMessage.filename);
              Extensao_Documento := Copy(Extensao_Documento,2,length(Extensao_Documento));
            end;
            5: Extensao_Documento := 'jpg'; //'webp';
            6: Extensao_Documento := 'mp4'; //Instant Vídeo
          end;
          //Novo 05/11/2022
          Automato_Path := ExtractFilePath(ParamStr(0));

          NomeArq_Whats := WPPConnectDecrypt.download(AMessage.deprecatedMms3Url,
                          AMessage.mediaKey, Extensao_Documento, AChat.id, Automato_Path + 'Temp\');