Skip to content

Commit

Permalink
Add ability to set trade offer message
Browse files Browse the repository at this point in the history
  • Loading branch information
dm1tz committed Aug 2, 2024
1 parent 9d2aaca commit f9b4db4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ public async Task<bool> JoinGroup(ulong groupID) {
}

[PublicAPI]
public async Task<(bool Success, HashSet<ulong>? TradeOfferIDs, HashSet<ulong>? MobileTradeOfferIDs)> SendTradeOffer(ulong steamID, IReadOnlyCollection<Asset>? itemsToGive = null, IReadOnlyCollection<Asset>? itemsToReceive = null, string? token = null, bool forcedSingleOffer = false, ushort itemsPerTrade = Trading.MaxItemsPerTrade) {
public async Task<(bool Success, HashSet<ulong>? TradeOfferIDs, HashSet<ulong>? MobileTradeOfferIDs)> SendTradeOffer(ulong steamID, IReadOnlyCollection<Asset>? itemsToGive = null, IReadOnlyCollection<Asset>? itemsToReceive = null, string? token = null, bool forcedSingleOffer = false, string? message = null, ushort itemsPerTrade = Trading.MaxItemsPerTrade) {
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {
throw new ArgumentOutOfRangeException(nameof(steamID));
}
Expand Down Expand Up @@ -628,7 +628,8 @@ public async Task<bool> JoinGroup(ulong groupID) {
{ "partner", steamID.ToString(CultureInfo.InvariantCulture) },
{ "serverid", "1" },
{ "trade_offer_create_params", !string.IsNullOrEmpty(token) ? new JsonObject { { "trade_offer_access_token", token } }.ToJsonText() : "" },
{ "tradeoffermessage", $"Sent by {SharedInfo.PublicIdentifier}/{SharedInfo.Version}" }
// Message length is limited to 128 characters.
{ "tradeoffermessage", !string.IsNullOrEmpty(message) ? (message.Length > 128 ? message.Substring(0, 125) + "..." : message) : $"Sent by {SharedInfo.PublicIdentifier}/{SharedInfo.Version}" }

Check warning on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Debug, macos-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check warning on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Debug, macos-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check warning on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Debug, ubuntu-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check warning on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Debug, ubuntu-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check warning on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Debug, windows-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check warning on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Debug, windows-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Release, macos-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Release, macos-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Release, ubuntu-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Release, ubuntu-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Release, windows-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / main (Release, windows-latest)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / publish-asf (ubuntu-latest, generic)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / publish-asf (ubuntu-latest, linux-arm)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / publish-asf (ubuntu-latest, linux-arm64)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / publish-asf (ubuntu-latest, linux-x64)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / publish-asf (macos-latest, osx-arm64)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / publish-asf (macos-latest, osx-x64)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / publish-asf (windows-latest, win-arm64)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)

Check failure on line 632 in ArchiSteamFarm/Steam/Integration/ArchiWebHandler.cs

View workflow job for this annotation

GitHub Actions / publish-asf (windows-latest, win-x64)

Use span-based 'string.Concat' and 'AsSpan' instead of 'Substring' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1845)
};

HashSet<ulong> tradeOfferIDs = new(trades.Count);
Expand Down

0 comments on commit f9b4db4

Please sign in to comment.