As someone mentioned if you are in distress sana please go see a daktari but what I am about to recommend is not just guidelines of how to get better but actual maintenance of the system to avoid such problems in the future.
Every time you eat always think of how whatever you eat will get out. The worst offenders for problems of piles are refined carbohydrates so think bread, cookies, biscuits (kwanza hizo sana) and things like meat. Everytime you eat anything just imagine whatever you eat if you could crush it in a blender and then squeeze out the water. Imagine how sticky on your insides the resultant stuff is.
The answer is roughage, or fiber. The cheapest most effective solution is a local product right under your nose. Sukuma Wiki. If you cook , you can do this for yourself, Salad oil kwa sufuria, you can make the oild a little excessive, kama unapenda onions and tomatoes you can throw these in and then sukuma wiki kwa wingi. Salt to taste. Kaanga and then serve. Don't eat kidogo, fill a whole plate like what a whole family should eat and eat as a meal before you go to bed. You can drink plenty of water after that as needed. You can eat with kidogo ugali but avoid anything sticky like anything made of wheat products, chapos, bread etc. The oil is to help with lubrication. Think of the sukuma as steel wool, yaani you are washing your insides. The next day morning enda chooni and if things don't seem to be moving you can drink a whole glass of warm water which helps to move bowels with ease. Whatever you do DON'T PUSH hard ama utajirarua. Take more warm water if things don't seem to be moving. The idea is pass out what looks exactly like what you ate. That way you know you have got everything out. You can do this sukuma wiki treatment 2 or 3 times a week.
A good habit to form though is where you incorporate in all your meals something that will pass unchanged in your system. It may be sukuma or spinach before any Nyama Choma, or fruits like oranges or Apples before breakfast or a leafy salad at lunchtime. Eat this roughage before the main meal and then indulge in whatever you are going to eat without guilt knowing that you have made it easy for things to flow out. Other good sources of fiber: Ndengu, whole wheat products, Ugali Number 2, Eat the whole real fruit not just the juice.
Good Luck.