Jump to content
McKay Development

manager.on("sentOfferChanged"), offer.setMessage() and community.editProfile() not working.


Recommended Posts

Posted

Hi, i got truble withi next methods: 
community.editProfile() method doesn't work correctly, this method doesn't set profile's summary and real name.

manager.on("sentOfferChanged") method doesn't work at all, neither does offer.setMessage()

My code:

this.community.editProfile({
            name: profile.nickname,
            realName: profile.realName ? profile.realName : "steam user",
            summary: profile..summary ? profile..summary : "about: ",
            country: profile.countryCode ? profile.countryCode : "",
            state: profile.stateCode ? profile.stateCode : "",
            city: profile.cityID ? profile.cityID : "",
            customURL: newUrl,
            background: "",
            featuredBadge: "",
            primaryGroup: "",
        }, (error) => {
            if (error) {
                console.log("editProfile", error);
            }
        });
 
async sendOffer(items: CEconItem[], steamID: string, tradeToken: string, message?: string) {
        const offer = this.manager.createOffer(steamID, tradeToken);
        offer.addTheirItems(items);
        offer.setMessage(message ? message : '');
        offer.send((err, status) => {
            if (err) {
                console.log(err);
            }
            console.log(status);
            if (status === "sent") {
               SteamBot.updateOne({ SteamLogin: this.botData.SteamLogin }, { $set: { Status: "Trade Pending" } });
            }
        });
        this.manager.on("sentOfferChanged", async (offer, oldState) => {
            console.log(`Offer #${offer.id} changed: ${TradeOfferManager.ETradeOfferState[oldState]} -> ${TradeOfferManager.ETradeOfferState[offer.state]}`);
            if (offer.state == TradeOfferManager.ETradeOfferState.Accepted) {
                console.log('accepted')
            }
            else if (offer.state == TradeOfferManager.ETradeOfferState.Active) {
                console.log('pending')
            }
            else {
                console.log("offer close")
            }
 
        })
    }
 

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...
×
×
  • Create New...