mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-06 17:10:13 +00:00
Extract PublicListing and MatchActively to a plugin, resurrect MatchActively (#2759)
* Start work on extracting remote communication * ok * Dockerfile fixes * More fixes * Prepare /Api/Announce and /Api/HeartBeat * Decrease publish race conditions * OK * Misc * Misc * Misc * Move Steam group part back to ASF core * Finally implement match actively v2 core * Update RemoteCommunication.cs * Use single round exclusively, report inventories more often * Use randomization when asking others for assetIDs * Add support for license and crowdin * Kill dead code * Fix return type of inventories * Fix responses for good * Unify old backend with new * Report whole inventory, always Helps with optimization on the backend side in terms of inventory fetching * Update RemoteCommunication.cs * Determine index of each asset and tell server about it * Update AnnouncementRequest.cs * Fix ASF screwing up with the order * Fix warnings * Misc rename * Final logging touches
This commit is contained in:
committed by
GitHub
parent
fd517294d1
commit
98ef37e722
39
ArchiSteamFarm/Plugins/Interfaces/IBotIdentity.cs
Normal file
39
ArchiSteamFarm/Plugins/Interfaces/IBotIdentity.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
// _ _ _ ____ _ _____
|
||||
// / \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
|
||||
// / _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
|
||||
// / ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
|
||||
// /_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
|
||||
// |
|
||||
// Copyright 2015-2022 Łukasz "JustArchi" Domeradzki
|
||||
// Contact: JustArchi@JustArchi.net
|
||||
// |
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// |
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
// |
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using ArchiSteamFarm.Steam;
|
||||
using JetBrains.Annotations;
|
||||
using SteamKit2;
|
||||
|
||||
namespace ArchiSteamFarm.Plugins.Interfaces;
|
||||
|
||||
[PublicAPI]
|
||||
public interface IBotIdentity : IPlugin {
|
||||
/// <summary>
|
||||
/// ASF will call this method when bot receives its own identity information.
|
||||
/// </summary>
|
||||
/// <param name="bot">Bot object related to this callback.</param>
|
||||
/// <param name="data">Full data received by ASF in the callback that relates to this bot (Steam) account.</param>
|
||||
/// <param name="nickname">Parsed nickname set for this bot (Steam) account.</param>
|
||||
/// <param name="avatarHash">Parsed hash of the avatar of this bot (Steam) account, as hex.</param>
|
||||
Task OnSelfPersonaState(Bot bot, SteamFriends.PersonaStateCallback data, string? nickname, string? avatarHash);
|
||||
}
|
||||
@@ -453,6 +453,21 @@ public static class PluginsCore {
|
||||
}
|
||||
}
|
||||
|
||||
internal static async Task OnSelfPersonaState(Bot bot, SteamFriends.PersonaStateCallback data, string? nickname, string? avatarHash) {
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
ArgumentNullException.ThrowIfNull(data);
|
||||
|
||||
if ((ActivePlugins == null) || (ActivePlugins.Count == 0)) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await Utilities.InParallel(ActivePlugins.OfType<IBotIdentity>().Select(plugin => plugin.OnSelfPersonaState(bot, data, nickname, avatarHash))).ConfigureAwait(false);
|
||||
} catch (Exception e) {
|
||||
ASF.ArchiLogger.LogGenericException(e);
|
||||
}
|
||||
}
|
||||
|
||||
internal static async Task<string?> OnBotMessage(Bot bot, ulong steamID, string message) {
|
||||
ArgumentNullException.ThrowIfNull(bot);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user