I understand that earthworms like to live in a cool environment. But I live in a country with a hot climate. How do I keep my wormies cool? Can specific diets help?
Unfortunately diet isn’t a solution. Generically almost any critter can withstand a slightly more stressful environment if it is especially healthy. But good food won’t make it immune to an environment that’s a whole lot more stressful. Hot and dry, if sufficiently extreme, are so much stress that generic good health won’t help. Just the same, keep the worms as healthy as you can. The comment addresses that well.
There’s no substitute for a livable temperature. Here are some ways to keep them cooler:
Shade is good, and if the worms in question are in a box or a a small area then shade may be something over which you have relatively more control. Keep the shadecloth, or cardboard, or whatever other tent you invent, elevated or classically tent-shaped. Actually covering a worm box will seal in hot air and that’s really bad for the worms. Directly covering bare soil, if we’re talking about an open garden, is OK, however. Short of plastic, the covering bare soil won’t seal out air exchange.
Mulch is a fine thing for earthworms, and shade for the soil surface is one of a couple reasons. So is retaining moisture. You could give them both a shade tent and on the soil surface also a layer of almost anything organic - newspaper (ripped up and crumpled, to keep that air flow going), leaves, sawdust, manure, wood chips, etc.
Moisture helps not only for its own sake but also because evaporation from the soil surface cools it. So keep the soil moist. Mud and puddled water are not good, however. That can kill worms. The box would do well to have some tiny drain holes, just small enough that the worms can’t leave.
Surrounding the worms with a cool surface will help. If it’s a worm box, consider sinking it in the soil so that the top of the box is about level with the surrounding soil surface.
If the worms of concern aren't in a box, I wouldn’t worry all that much and besides there isn’t a whole lot you can do about it. Worms will move deeper in the soil if they need to, usually in order to avoid dry soil but also to avoid heat. Just keep the irrigation going to the degree that the worms are a priority.