Answer: Peppers are potentially subject to attack by a variety of worms, weevils and borers. Fortunately some years are better than others, so it may not happen again next year. The best you can do on a preventive basis is to clean up all of the plant debris at the end of the season and dispose of it in the trash, be sure to rotate your plantings to avoid replanting peppers (or tomatoes) in the same spot for several years, and then be on the lookout for trouble so you can try to stop it early next time.
The blackening may be a disease or fungal problem, or if it is on the end opposite the stem may be blossom end rot (BER). BER is most often caused when soil moisture levels fluctuates from wet to dry. Keeping the soil evenly moist (not sopping wet, not dried out)should prevent that. If it is a disease, the clean up and rotation should help as would trying perhaps a different variety of pepper with better disease resistance.
You may also want to consult with a local professionally trained nurseryman with experience in growing peppers to try to get a more specific diagnosis and based on knowing that, you can figure out how to proceed. I'm sorry about your peppers.
Q&A Library Searching Tips