Files
Gwendolyn/main.py
2021-06-16 14:12:21 +02:00

31 lines
842 B
Python

"""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()