Save image in Discord

I have created a macro in which first I sent prompt via api and it creates a json file for me. in KM it then detects the json file and extract the prompt and save in variable then it opens the discord and enter the saved prompt enter in Midjourney bot and creates images for me. I just have to sent prompt via json that's it. this is absolutely working fine BUT now I want to save image automatically like when images creates it save images for me in my folder. I write a discord code for saving images by first creating discord app enable all necessary permissions but it is not working. Can somebody help me in that? How I can save images automatically?