-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to set trade offer message #3262
Conversation
I would prefer this to be IN ADDITION to the information already contained and not instead of it. |
Now that I think of it, I personally also would like for ASF to include information about the calling assembly (in case it differs from ASF and official plugins). |
What if provided message is larger than the max. chars (128) a trade offer message can handle?
I'm still unsure if it is safe to allow 3rd party plugins to override the message,.. would be better to append I guess. |
Good point, we could preemptively truncate the message if it exceeds the limit.
Could you please elaborate? I'd argue that overriding the standard message is a more flexible approach, and given that the default message (e.g. Besides, nothing is stopping you from re-implementing |
@@ -628,7 +628,8 @@ public sealed class ArchiWebHandler : IDisposable { | |||
{ "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 ? string.Concat(message.AsSpan(0, 125), "...") : message) : $"Sent by {SharedInfo.PublicIdentifier}/{SharedInfo.Version}" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aside all the other stuff: 128
should be a const
and the substring length should be derived from it. Furthermore, there is a continuation character containing 3 dots (reducing the amount of chars we use). Please take a look at SteamChatMessage.cs
I don't see any added value other than abuse potential in replacing the message, not like I care much about it, but trade offer message isn't a place for putting arbitrary info. We can totally append extra informaton though, so with current code I've committed above you have approx 80 characters for adding anything you deem important, which should be enough for an identifier, link, or even some kind of hash or summary. Should be sufficient for any legit use cases this PR aimed for, while not disrupting ASF's way of doing things by being transparent in everything it's doing. |
Checklist
Changes
New functionality
Adds the ability to set a custom message when sending an offer.
Additional info
This is particularly useful for third-party plugins that implement custom trading logic, as a message can convey useful information and/or help users differentiate offers created by ASF from those created by plugins.