mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 15:14:41 +00:00
Misc
This commit is contained in:
parent
2e31d7ff39
commit
6747599b6e
2 changed files with 50 additions and 4 deletions
|
@ -96,6 +96,10 @@ namespace ArchiSteamFarm {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
CChatRoom_AckChatMessage_Notification request = new CChatRoom_AckChatMessage_Notification {
|
||||
chat_group_id = chatGroupID,
|
||||
chat_id = chatID,
|
||||
|
@ -111,6 +115,10 @@ namespace ArchiSteamFarm {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
CFriendMessages_AckMessage_Notification request = new CFriendMessages_AckMessage_Notification {
|
||||
steamid_partner = steamID,
|
||||
timestamp = timestamp
|
||||
|
@ -145,6 +153,10 @@ namespace ArchiSteamFarm {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CPlayer_AddFriend_Request request = new CPlayer_AddFriend_Request { steamid = steamID };
|
||||
|
||||
SteamUnifiedMessages.ServiceMethodResponse response;
|
||||
|
@ -170,6 +182,10 @@ namespace ArchiSteamFarm {
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CClanChatRooms_GetClanChatRoomInfo_Request request = new CClanChatRooms_GetClanChatRoomInfo_Request {
|
||||
autocreate = true,
|
||||
steamid = steamID
|
||||
|
@ -198,6 +214,10 @@ namespace ArchiSteamFarm {
|
|||
}
|
||||
|
||||
internal async Task<HashSet<ulong>> GetMyChatGroupIDs() {
|
||||
if (!Client.IsConnected) {
|
||||
return null;
|
||||
}
|
||||
|
||||
CChatRoom_GetMyChatRoomGroups_Request request = new CChatRoom_GetMyChatRoomGroups_Request();
|
||||
|
||||
SteamUnifiedMessages.ServiceMethodResponse response;
|
||||
|
@ -228,6 +248,10 @@ namespace ArchiSteamFarm {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CChatRoom_JoinChatRoomGroup_Request request = new CChatRoom_JoinChatRoomGroup_Request { chat_group_id = chatGroupID };
|
||||
|
||||
SteamUnifiedMessages.ServiceMethodResponse response;
|
||||
|
@ -348,6 +372,10 @@ namespace ArchiSteamFarm {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CPlayer_RemoveFriend_Request request = new CPlayer_RemoveFriend_Request { steamid = steamID };
|
||||
|
||||
SteamUnifiedMessages.ServiceMethodResponse response;
|
||||
|
@ -368,6 +396,10 @@ namespace ArchiSteamFarm {
|
|||
}
|
||||
|
||||
internal void RequestItemAnnouncements() {
|
||||
if (!Client.IsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClientMsgProtobuf<CMsgClientRequestItemAnnouncements> request = new ClientMsgProtobuf<CMsgClientRequestItemAnnouncements>(EMsg.ClientRequestItemAnnouncements);
|
||||
Client.Send(request);
|
||||
}
|
||||
|
@ -378,6 +410,10 @@ namespace ArchiSteamFarm {
|
|||
return EResult.Fail;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return EResult.NoConnection;
|
||||
}
|
||||
|
||||
CFriendMessages_SendMessage_Request request = new CFriendMessages_SendMessage_Request {
|
||||
chat_entry_type = (int) EChatEntryType.ChatMsg,
|
||||
contains_bbcode = true,
|
||||
|
@ -408,6 +444,10 @@ namespace ArchiSteamFarm {
|
|||
return EResult.Fail;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return EResult.NoConnection;
|
||||
}
|
||||
|
||||
CChatRoom_SendChatMessage_Request request = new CChatRoom_SendChatMessage_Request {
|
||||
chat_group_id = chatGroupID,
|
||||
chat_id = chatID,
|
||||
|
@ -437,6 +477,10 @@ namespace ArchiSteamFarm {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!Client.IsConnected) {
|
||||
return;
|
||||
}
|
||||
|
||||
ClientMsgProtobuf<CMsgClientUIMode> request = new ClientMsgProtobuf<CMsgClientUIMode>(EMsg.ClientCurrentUIMode) { Body = { chat_mode = chatMode } };
|
||||
Client.Send(request);
|
||||
}
|
||||
|
|
|
@ -929,7 +929,7 @@ namespace ArchiSteamFarm {
|
|||
try {
|
||||
bool sent = false;
|
||||
|
||||
for (byte j = 0; (j < WebBrowser.MaxTries) && !sent; j++) {
|
||||
for (byte j = 0; (j < WebBrowser.MaxTries) && !sent && IsConnectedAndLoggedOn; j++) {
|
||||
EResult result = await ArchiHandler.SendMessage(steamID, messagePart).ConfigureAwait(false);
|
||||
|
||||
switch (result) {
|
||||
|
@ -937,6 +937,7 @@ namespace ArchiSteamFarm {
|
|||
sent = true;
|
||||
break;
|
||||
case EResult.RateLimitExceeded:
|
||||
case EResult.Timeout:
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
continue;
|
||||
default:
|
||||
|
@ -946,7 +947,7 @@ namespace ArchiSteamFarm {
|
|||
}
|
||||
|
||||
if (!sent) {
|
||||
ArchiLogger.LogGenericError(Strings.WarningFailed);
|
||||
ArchiLogger.LogGenericWarning(Strings.WarningFailed);
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
|
@ -991,7 +992,7 @@ namespace ArchiSteamFarm {
|
|||
try {
|
||||
bool sent = false;
|
||||
|
||||
for (byte j = 0; (j < WebBrowser.MaxTries) && !sent; j++) {
|
||||
for (byte j = 0; (j < WebBrowser.MaxTries) && !sent && IsConnectedAndLoggedOn; j++) {
|
||||
EResult result = await ArchiHandler.SendMessage(chatGroupID, chatID, messagePart).ConfigureAwait(false);
|
||||
|
||||
switch (result) {
|
||||
|
@ -999,6 +1000,7 @@ namespace ArchiSteamFarm {
|
|||
sent = true;
|
||||
break;
|
||||
case EResult.RateLimitExceeded:
|
||||
case EResult.Timeout:
|
||||
await Task.Delay(1000).ConfigureAwait(false);
|
||||
continue;
|
||||
default:
|
||||
|
@ -1008,7 +1010,7 @@ namespace ArchiSteamFarm {
|
|||
}
|
||||
|
||||
if (!sent) {
|
||||
ArchiLogger.LogGenericError(Strings.WarningFailed);
|
||||
ArchiLogger.LogGenericWarning(Strings.WarningFailed);
|
||||
return false;
|
||||
}
|
||||
} finally {
|
||||
|
|
Loading…
Reference in a new issue