Get Started - Learn How To Make Your Bot!GuidesCode SnippetsGet methodsPost methodsWeb APIUseful linksList of all currently Free ItemsList of EmotesHighrise Bot SDK Changelog
Added on version 23.1.0b13
before_start(self, tg: TaskGroup) -> None:
This method is triggered when your code starts running.
⚙️ Use cases
You can use methods to start variables, databases, dataclasses and tasks. The nice thing about this method is that if your Bot get’s reconnected, if your code keeps runing, everything started in this method will continue in their state contrary to the method that will reload everytime the Bot get’s reconnected.
Here’s an example that I made to integrate my bot with a Pandas Database Class that I created to manage deposits made to the bot:
async def before_start(self, tg: TaskGroup) -> None: self.db = Database() self.db = await Database.create() self.deposits = DepositsTable(self.db) self.withdrawns = WithdrawnsTable(self.db) self.totals = TotalsTable(self.db)