Jump to content
McKay Development

Recommended Posts

Posted

Hello,

I'm currently stuck with something that I assume is very simple, but I can't find any tutorial or help about it anywhere on the internet...

 

I'm currently trying to create a bot that trades random Steam game codes for random steam cards, but my problem right now is that I don't know how to check if all items that the bot will receive are trading cards.

 

I'm aware that this probably is a really easy thing, but I really have no idea where to find my answers :/

 

 

Thanks a lot for reading this, hopefully you can me with that :P

 

This is what I have done so far :

//This is where the pain begins.
function processOffer(offer) {
 if (offer.partner.getSteamID64() === config.ownerID) {
    acceptOffer(offer);
} else if (offer.isGlitched() || offer.state === 11) {
    console.log("Offer was glitched, declining.");
    declineOffer(offer);
} else {
    var theirItems = offer.itemsToReceive
    var ourItems = offer.itemsToGive

}}


manager.on('newOffer', (offer) => {
    console.log("Offer received, processing");
    processOffer(offer);
})}
Posted

Do something like this:

let isEachItemATradingCard = theirItems.every((item) => {
	if (item.appid != 753 || item.contextid != 6) {
		// AppID is not "Steam" or contextid is not "Community"
		return false;
	}
	
	let tag = item.getTag('item_class');
	if (!tag || tag.internal_name != 'item_class_2') {
		// Not a trading card
                // You could also check that tag.localized_tag_name == 'Trading Card' but that would only work for English
		return false;
	}
	
	return true; // all checks passed
});

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...