Jump to content
McKay Development

Mistake in performSearch function?

Recommended Posts

Good day,

I have been trying to make a function that searches for a random item on the steam market, I ran into an issue. Here is the error:

C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\classes\CMarketSearchResult.js:62
                                callback(new Error($errorMsg.text()));

TypeError: callback is not a function
    at SteamCommunity.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\classes\CMarketSearchResult.js:62:5)
    at Request._callback (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\steamcommunity\components\http.js:67:15)
    at Request.self.callback (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:185:22)
    at Request.emit (events.js:315:20)
    at Request.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:1154:10)
    at Request.emit (events.js:315:20)
    at Gunzip.<anonymous> (C:\Users\Ernest\Desktop\SteamBot\Current Version\node_modules\request\request.js:1076:12)
    at Object.onceWrapper (events.js:421:28)
    at Gunzip.emit (events.js:315:20)
    at endReadableNT (internal/streams/readable.js:1327:12)

C:\Users\Ernest\Desktop\SteamBot\Current Version>pause
Press any key to continue . . .


Looking at the code here is what I see:

function performSearch() {
            "qs": qs,
            "headers": {
        }, function(err, response, body) {
            if (err) {
            if(!body.success) {
                callback(new Error("Success is not true"));
            if(!body.results_html) {
                callback(new Error("No results_html in response"));
            var $ = Cheerio.load(body.results_html);
            var $errorMsg = $('.market_listing_table_message');
            if($errorMsg.length > 0) {
                callback(new Error($errorMsg.text()));
            var rows = $('.market_listing_row_link');
            for(var i = 0; i < rows.length; i++) {
                results.push(new CMarketSearchResult($(rows)));
            if(body.start + body.pagesize >= body.total_count) {
                callback(null, results);
            } else {
                qs.start += body.pagesize;
        }, "steamcommunity");

Here is my code:

    community.marketSearch(query, 730falsefunction(err, items) {
        if (err) {
        } else {

I don't think there is anything wrong with my code, any ideas?

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.

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.

  • Create New...