EnelGy Posted September 7, 2020 Report Posted September 7, 2020 (edited) I there any code/function to detect last accepted offer and say what was opponents trade link ??? The reason why do I need it is because when 2 different users got offers, and 1 of them accepts the trade, bot doesnt know who confirmed, (but registered that someone confirmed) so bot sends them both message like "Success trade confirmed " Edited September 7, 2020 by EnelGy Quote
Dr. McKay Posted September 8, 2020 Report Posted September 8, 2020 You can't get a trade link (with token) from an offer. The SteamID of the other party in a trade offer is available as the partner property. Quote
EnelGy Posted September 8, 2020 Author Report Posted September 8, 2020 (edited) Could you please help me ?? So how could I prevent that bot will not respond both users when only 1 user confirmed the trade offer ?? It is really frustrating to see it and really dont know how to prevent it in chat it looks like this: (1 - user "EnelGy" accepted the trade, 2 - user "Command" wrote the same command, but didnt accept the trade...) And if the user who won accept the trade that bot is sending his winnings, it resets(like he registered sentOfferChanged() - accepted offer) and generates another game where also are 2 users: After accepting the win: this is constant.... so bot will end sending winning trades after his inv is empty or bots users lose Btw I am storing users trade link inside some json file so there could be some call function (each user is signed there with his discord id and has there trade link in strings Edited September 27, 2020 by EnelGy Quote
Dr. McKay Posted September 9, 2020 Report Posted September 9, 2020 You should only have one sentOfferChanged handler. You should not add a new handler every time you send a trade. Quote
EnelGy Posted September 9, 2020 Author Report Posted September 9, 2020 (edited) But what if I want it to have that handler on specific trade ? There are 2 diffrent sending trades functions, first is the bot doesnt give anything, and this i want to check if is confirmed, second is the bot is giving.. (I have solved it wuth adding if statements on itemstogive == 0) 1. How can I know that first sent trade offer is matching with some id ?? like if (offer.id === ______)... I need something that says if (offer.id.state === "accepted"), but this code wont work, how can i do it ?? 2. Some developer told that i can fix this using polldata, is it possible ?? Edited September 10, 2020 by EnelGy Quote
Dr. McKay Posted September 10, 2020 Report Posted September 10, 2020 If you're already keeping track of offer IDs paired with discord user data, then you should just have one sentOfferChanged handler and check the offer.id inside of that callback. Quote
EnelGy Posted September 10, 2020 Author Report Posted September 10, 2020 (edited) the callback is where ? Edited September 10, 2020 by EnelGy Quote
Dr. McKay Posted September 10, 2020 Report Posted September 10, 2020 manager.on('sentOfferChanged', (offer, oldState) => { // This is the callback // offer.id is the ID of the trade offer that changed }); Quote
EnelGy Posted September 10, 2020 Author Report Posted September 10, 2020 (edited) How can I check ? I knew what is offer.id but didnt know how to check ... Edited September 10, 2020 by EnelGy Quote
Recommended Posts
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.