I think you just have to be quite firm with people, whether it sounds nice to them or not. If there's one thing my breakdown in Oxford and subsequent mental health problems taught me it's that you must ALWAYS ALWAYS put yourself first, no matter how selfish may seem or how big the other person's problems are. You must NEVER put anyone or anything before your own needs
So whether it's a matter of ignoring someone, shutting a conversation down abruptly or saying "I'm really sorry but I can't deal with this right now and need to focus on myself", you've just gotta do what you've gotta do. That way, in long run, you will be able ot provide better help to more people. You can't put others first if you end up burnt out (like me) or (worst case scenario) dead because you have prioritised others for too long
So just say no in future. However it may seem, a good friend (or at least someone worth still talking to) will understand and at least try not to take it to heart
Someone who insists on having your attention and who demands it even if you are not well enough to give it, is possibly toxic and not worth keeping in touch with anyway