Get User's Avatar
Closed this issue · 5 comments
Hi, is it possible to download a user's avatar using the API?
If it is possible to download it using the telnet commands, then its possible with this api. This api is just a wrapper arround the official telnet api.
Okay, so it's not an integrated function...
I'll try to do something and I hope to be able to do a pull request to add this feature :)
You can get the filename of the users avatar this way:
- QueryRunner.QueryUtils.GetAvatarFilename(uint clientId)
And then you can just download it using the Method "DownloadFile" of SyncFileTransfer or AsyncFileTransfer class.
Okay, I have a problem with the DownloadFile Method...
I don't actually know how to call the method...
I did try using the InitializeFileDownload function but I don't actually know how to download the image itself...
Okay, I'm a dumbass, thank you so much :)
For everyone else who want to download it, here's how I did:
InitializeFileDownloadResponse test = queryRunner.InitializeFileDownload(((uint)new Random().Next(1, 65535)), filename, 0, 0); SyncFileTransfer.DownloadFile(test.FileTransferKey, test.FileSize.GetValueOrDefault(), targetHost, targetFileTransferPort, fileLocation);