✨ PEP in utils
This commit is contained in:
30
main.py
Normal file
30
main.py
Normal file
@ -0,0 +1,30 @@
|
||||
"""Runs the Gwendolyn bot."""
|
||||
|
||||
import platform # Used to test if the bot is running on windows, in
|
||||
# order to fix a bug with asyncio
|
||||
import asyncio # used to set change the loop policy if the bot is
|
||||
# running on windows
|
||||
|
||||
from gwendolyn import Gwendolyn
|
||||
from gwendolyn.utils import make_files
|
||||
|
||||
|
||||
def main():
|
||||
"""Starts the bot"""
|
||||
if platform.system() == "Windows":
|
||||
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
|
||||
|
||||
# Creates the required files
|
||||
make_files()
|
||||
|
||||
# Creates the Bot
|
||||
bot = Gwendolyn()
|
||||
|
||||
try:
|
||||
# Runs the whole shabang
|
||||
bot.run(bot.credentials["token"])
|
||||
except Exception as exception: # pylint: disable=broad-except
|
||||
bot.log(bot.long_strings[f"Can't log in: {repr(exception)}"])
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
Reference in New Issue
Block a user