Jump to content
McKay Development

Send trade and error


Recommended Posts

Good afternoon again, Doctor.
Can you please tell me if steam can give an error when offer.send but still send the trade? (because steam is shit)

 

 this.sentOffer = this.manager.createOffer(
        new TradeOfferManager.SteamID(this.withdraw.steamUser.steamId),
        this.withdraw.tradeToken.token,
      );

      this.sentOffer.addMyItem({
        assetid: this.withdraw.botItem.assetId,
        appid: this.withdraw.botItem.item.gameId,
        contextid: 2,
      });

      return new Promise((resolve, reject) => {
        this.sentOffer.send(async (tradeError, status) => {
          if (tradeError) {
            if (this.sentOffer) {
              this.sentOffer.cancel();
            }

            return reject(tradeError);
          }

          if (status === "pending") {
            telegramBotCreateOffer(this.bot, JSON.stringify(this.sentOffer));

            this.community.acceptConfirmationForObject(
              this.bot.identitySecret,
              this.sentOffer.id,
              async err => {
                if (err) {
                  this.sentOffer.cancel();
                  await error(err);
                }
              },
            );

            return resolve();
          }

          // here i have to cancel the trade?
          return reject();
        });
      });

 

Edited by drdr
Link to comment
Share on other sites

Pretty much anything is possible when Steam is involved. You should be prepared to handle an eventuality where an offer send fails but it ends up going through and being accepted.

You can use the unknownOfferSent event to detect when an offer goes through that isn't expected to (i.e. you called offer.send and it succeeded).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...