refactor(bot): rename main function for clarity
Renamed `main` to `main_async` to better reflect its asynchronous nature. Introduced a new `main` function that runs the async function within the event loop. This refactor improves code readability and better distinguishes between the synchronous entry point and the primary asynchronous logic.
This commit is contained in:
parent
6d62dc99c8
commit
8c1e5c33dc
1 changed files with 6 additions and 2 deletions
|
@ -221,7 +221,7 @@ class RoombaBot:
|
|||
)
|
||||
|
||||
|
||||
async def main():
|
||||
async def main_async():
|
||||
# Load configuration from config.yaml
|
||||
with open("config.yaml", "r") as config_file:
|
||||
config = yaml.safe_load(config_file)
|
||||
|
@ -259,5 +259,9 @@ async def main():
|
|||
await bot.start()
|
||||
|
||||
|
||||
def main():
|
||||
asyncio.get_event_loop().run_until_complete(main_async())
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
asyncio.get_event_loop().run_until_complete(main())
|
||||
main()
|
||||
|
|
Loading…
Reference in a new issue