python-discord / quackstack

An on-demand procedural ducky delivery service. An infinite stack of duckies!
MIT License
7 stars 1 forks source link

Allow to pass options while generating Man Ducks #35

Closed Shivansh-007 closed 3 years ago

Shivansh-007 commented 3 years ago

Relevant Issues

Closes #33

Description

This PR does few miscellaneous changes and the major change: allows to pass options while generating a cute man duck.

Miscellaneous Changes:

Major Change

This PR adds two models, one for the Dress Colors of man-ducks and other is the options for generating a man-duck.

This also refactors the man-duck code to not make it repetitive and for each key in the template for generation, there is a tuple, this tuple contains two elements, i.e. Image object and the color for that object, if there is no color then it is a empty object.

vcokltfre commented 3 years ago

Okay! This now works perfectly when giving it correct options, however if I give it an invalid option, for example i set the outfit to aaaaaaaaaaa rather than a valid one, instead of getting a 400 bad request I get a 500, so I'd like to see that handled internally too, here's how it's done in normal duck generation, but you may want to refine it: (line 68, ducky.py)

        if equipment and equipment not in cls.equipments:
            raise HTTPException(400, "Invalid equipment provided.")

        if outfit and outfit not in cls.outfits:
            raise HTTPException(400, "Invalid outfit provided.")

        if hat and hat not in cls.hats:
            raise HTTPException(400, "Invalid hat provided.")
Shivansh-007 commented 3 years ago

Changes mentioned @vcokltfre !