AW: Discord "message": "Cannot send an empty message", "code": 50006
Zitat:
auch hier das gleiche ergebnis... [dcc32 Fehler] Unit5.pas(54): E2250 Es gibt keine überladene Version von 'Seek', die man mit diesen Argumenten aufrufen kann |
AW: Discord "message": "Cannot send an empty message", "code": 50006
nur zur Korrektur:
Delphi-Quellcode:
oder
LSStream.seek(0,soFromBeginning);
Delphi-Quellcode:
params.seek(0,soFromBeginning);
|
AW: Discord "message": "Cannot send an empty message", "code": 50006
Zitat:
Delphi-Quellcode:
1
2 {"message": "Cannot send an empty message", "code": 50006} 3 |
AW: Discord "message": "Cannot send an empty message", "code": 50006
.. kannst Du aufzeichen/sehen (Wireshark, Fiddler) was zum Server geschickt wird?
Vielleicht stimmt ja mit der Nachricht etwas nicht. Grüße Klaus |
AW: Discord "message": "Cannot send an empty message", "code": 50006
Versuch das mal so. StringList statt StringStream und ein explizites Add().
Delphi-Quellcode:
procedure TForm5.btn2Click(Sender: TObject);
var params: TStringList; LIndy: TIdHTTP; LResponse:string; begin LIndy:= TIdHTTP.Create(); params := TStringList.Create; try params.Add('{"content": "Test"}'); LIndy.Request.ContentType := 'application/json'; LIndy.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36'; LResponse := LIndy.Post(FUrl, params); finally LIndy.Free; params.Free; end; end; |
AW: Discord "message": "Cannot send an empty message", "code": 50006
Zitat:
|
AW: Discord "message": "Cannot send an empty message", "code": 50006
Zitat:
aber leider funzt auch das nicht...
Delphi-Quellcode:
Ergebnis
var
params: TStringStream; LIndy: TIdHTTP; LResponse:string; LsList: TStringList; const LContent = '{"content": "Test"}'; begin LIndy:= TIdHTTP.Create(); params := TStringStream.Create(LContent, TEncoding.UTF8); LsList := TStringList.Create; try params.seek(0,soFromBeginning); LsList.DefaultEncoding.UTF8; LsList.Add('{"content": "Test"}'); LIndy.Request.ContentType := 'application/json'; LIndy.Request.UserAgent := 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36'; LResponse:= LIndy.Post(FUrl, params); mmo1.Lines.Add('3 ' + LResponse); try LResponse:= LIndy.Post(FUrl, LsList); except on E : Exception do begin mmo1.Lines.Add(E.Message); end; end; mmo1.Lines.Add('4 ' + LResponse); finally LIndy.Free; params.Free; LsList.Free; end; end;
Delphi-Quellcode:
3
HTTP/1.1 400 BAD REQUEST 4 |
AW: Discord "message": "Cannot send an empty message", "code": 50006
Das was da oben steht würde ich erstmal komplett löschen. Das ist eine Mischung aus beiden.
Am besten suchst du dir einen großen und vernünftigen Discord-Server wo sich die Leute mit sowas befassen und fragst da mal nach. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:32 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz