Drxckzyz / random-jokes

A Package that allows you to get different type of jokes
2 stars 1 forks source link

`getRandomJoke()` when blacklisting returns `undefined` results #44

Open iced-queen opened 1 month ago

iced-queen commented 1 month ago

Like the title says, the getRandomJoke() when using blacklists gives undefined results like:

{ safe: undefined, joke: undefined }

My code:

const blacklist = [
    `religious`,
    `political`,
    `racist`,
];

const joke = await getRandomJoke(blacklist);

If I remove blacklist from the parameter, it returns a joke just fine.

Drxckzyz commented 1 month ago

Will look into this Thank you for bringing this to my attention.

iced-queen commented 2 weeks ago

Will look into this Thank you for bringing this to my attention.

Hey, any updates? :)

iced-queen commented 2 weeks ago

I made a fix to my issue: https://github.com/Drxckzyz/random-jokes/commit/9c9782e3b7e308ff10bc2b2113109a71b688e8d1 Also fixed another little issue that caused errors when using blacklists, and added the category to the return :)

iced-queen commented 2 weeks ago

Something I forgot.. could you maybe also have it return the j.type? ("single", "twopart")

iced-queen commented 2 weeks ago

Also, just noticed there are things that needs to be changed in index.d.ts. I'm not really familiar with typescript, so I'll leave that part to you 😅

iced-queen commented 2 weeks ago

Last message 😅: Made a commit including the fixes from before, and having it return information I think would be useful: https://github.com/Drxckzyz/random-jokes/commit/ce1d226b5e3468293da3f3189860ace71e70570a The only thing I don't need returned here is the category (at least as of now), but I'm sure others would find it useful. :))

(Apologies for the many messages and commits/pr, but I believe this is the last one 🙂)