Add !level command (#946)

* add !level command

* Added blank lines

* Fix https://github.com/JustArchiNET/ArchiSteamFarm/pull/946

* Fix №2 https://github.com/JustArchiNET/ArchiSteamFarm/pull/946
This commit is contained in:
MisakaDev
2018-11-14 21:51:21 +02:00
committed by Łukasz Domeradzki
parent c6ad260e81
commit ab6ce7c7e5
4 changed files with 256 additions and 171 deletions

View File

@@ -213,6 +213,34 @@ namespace ArchiSteamFarm {
return body.chat_group_summary.chat_group_id;
}
internal async Task<uint?> GetLevel() {
if (!Client.IsConnected) {
return null;
}
CPlayer_GetGameBadgeLevels_Request request = new CPlayer_GetGameBadgeLevels_Request { };
SteamUnifiedMessages.ServiceMethodResponse response;
try {
response = await UnifiedPlayerService.SendMessage(x => x.GetGameBadgeLevels(request));
} catch (Exception e) {
ArchiLogger.LogGenericWarningException(e);
return null;
}
if (response == null) {
ArchiLogger.LogNullError(nameof(response));
return null;
}
if (response.Result != EResult.OK) {
return null;
}
CPlayer_GetGameBadgeLevels_Response body = response.GetDeserializedResponse<CPlayer_GetGameBadgeLevels_Response>();
return body.player_level;
}
internal async Task<HashSet<ulong>> GetMyChatGroupIDs() {
if (!Client.IsConnected) {
return null;