From 1b8053217d0e5788f8d11d150441ca9a73639a00 Mon Sep 17 00:00:00 2001 From: Luois45 Date: Wed, 29 Dec 2021 17:09:39 +0100 Subject: [PATCH] Added compatibility for deployment on Heroku --- Procfile | 1 + discord-shop.py | 27 +++++++++++++++++++++------ requirements.txt | 1 + 3 files changed, 23 insertions(+), 6 deletions(-) create mode 100644 Procfile diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..52897eb --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +worker: python discord-shop.py \ No newline at end of file diff --git a/discord-shop.py b/discord-shop.py index 0144523..e984905 100644 --- a/discord-shop.py +++ b/discord-shop.py @@ -40,12 +40,8 @@ async def get_database_user(user, reaction): return database_user -@client.event -async def on_ready(): - print("Discord: Logged in as {0.user}".format(client)) - await client.change_presence(activity=discord.Activity( - type=discord.ActivityType.playing, name="DiscordShopBot")) - # Creates Support role if it doesn't exists +async def start_setup(message): + # Performs the setup of the bot for guild in client.guilds: roleExists = False categoryExists = False @@ -60,6 +56,23 @@ async def on_ready(): categoryExists = True if categoryExists == False: await guild.create_category("orders") + embed = discord.Embed(title="Performed setup sucessfully", + description="", + color=discord.Colour.from_rgb(255, 0, 0)) + embed.add_field( + name=f"Developer", + value= + "Louis_45#0553 | [GitHub](https://github.com/Luois45)\ndiscord-shop@louis45.de", + inline=True) + + await message.channel.send(embed=embed) + + +@client.event +async def on_ready(): + print("Discord: Logged in as {0.user}".format(client)) + await client.change_presence(activity=discord.Activity( + type=discord.ActivityType.playing, name="DiscordShopBot")) @client.event @@ -1028,6 +1041,8 @@ async def on_message(message): message = message if message.author != client.user and message.guild != None: role_names = [role.name for role in message.author.roles] + if message.content.startswith("=setup"): + await start_setup(message) if "Seller" in role_names: if message.content.startswith("=help"): await help_command(message) diff --git a/requirements.txt b/requirements.txt index 76fd26f..f470a75 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ ###### Requirements ###### +numpy discord.py==1.5.1 mysql-connector-python==8.0.22 requests==2.25.0