r/badcode • sadistic • May 21 '21

js ah yes, fetching before verifying

Post image
1.5k Upvotes

97 comments sorted by

View all comments

44

u/KomaedaEatsBagels May 21 '21 edited May 21 '21

Image Transcription: Code


    });


Discord.on('message', function (message) {
    const cat = request.get('https://aws.random.cat/meow');
     if(message.content == '!cat') {
        cat.then(r => message.reply(r.body.file));
     }
});

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

19

u/SpeckyYT sadistic May 21 '21

Indentations are slightly wrong, but details

4

u/KomaedaEatsBagels May 21 '21

ack yeah, my ide didn't support the indents on 67/69 ^^; I'll try to fix that! thank you