Forum:How to add a bot

Hello! I've been seeing bots on other wikis and have been wondering how to create a bot on my own. I've seen other forums but they don't answer my questions. What I do know is that you have to add some sort of flag but I also don't know how to add script to a bot, as I have never done it before. Thanks!
 * 1) I don't know how to do that
 * 2) I don't know how to get a bot account in the first place

Peace, Dark Sovereign 193