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:
Kumi 2024-08-17 15:44:54 +02:00
parent 6d62dc99c8
commit 8c1e5c33dc
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -221,7 +221,7 @@ class RoombaBot:
) )
async def main(): async def main_async():
# Load configuration from config.yaml # Load configuration from config.yaml
with open("config.yaml", "r") as config_file: with open("config.yaml", "r") as config_file:
config = yaml.safe_load(config_file) config = yaml.safe_load(config_file)
@ -259,5 +259,9 @@ async def main():
await bot.start() await bot.start()
def main():
asyncio.get_event_loop().run_until_complete(main_async())
if __name__ == "__main__": if __name__ == "__main__":
asyncio.get_event_loop().run_until_complete(main()) main()