yrevocnu / psychedelic-glass-bead-game

1 stars 2 forks source link

replace the supertest mechanic in the discord bot #16

Open sbenthall opened 3 years ago

sbenthall commented 3 years ago

The supertest mechanic in the discord bot is an outrage. OUTRAGE!

sbenthall commented 3 years ago

What would it be better to replace this with @benheller ?

benheller commented 3 years ago

The way to "fix" this is to refactor the code such that the handlers are independent functions that can be called both from Discord actions and Express routes.

sbenthall commented 3 years ago

I'd like to tackle this. I'm wondering if there's a standard place to include helper functions in an Express directory/filesystem hierarchy.

I see:

app/
    models/
    routes/
    services/
        discord/

I'm thinking after reading a few blog posts about it that maybe discord/ should be popped up to the same level as routes/ and the handlers moved to services. But I defer to you.

benheller commented 3 years ago

I agree that discord/ should be at the same level as routes/. I'd move the handlers to a new folder at app/controllers or app/handlers that's shared between app/routes/ and app/discord/. If you need other helper functions (for things like array manipulation, sorting, etc) those could go in a new app/utils folder.

sbenthall commented 3 years ago

Thank you @benheller ! I will prioritize this ticket.