Extending Your Existing Bot With Sharpy - DrInfy/sharpy-sc2 GitHub Wiki
If you have an existing bot, but want to take advantage of some features in sharpy-sc2, you can convert your bot to sharpy somewhat easily.
Let's consider this following AwesomeBot
class AwesomeBot(BotAI)
def __init__(self):
# my awesome init
async def on_step(self, iteration):
# my awesome code
You should convert your old bot logic into an act to keep the bot file clean of external logic. The end result could look something like this:
class AwesomeAct(ActBase)
def __init__(self):
# my awesome init
super().__init__()
async def execute(self) -> bool:
# my awesome code
return True
class AwesomeBot(KnowledgeBot)
def __init__(self):
super().__init__("Awesome Bot")
async def create_plan(self) -> BuildOrder:
return BuildOrder(AwesomeAct())
For the code inside the new AwesomeAct find & replace self with "self.ai" and your bot should be ready to use all the features in sharpy.