From 5a94b573994c024a866714a2e91a5c392d3fe16b Mon Sep 17 00:00:00 2001 From: Anorak_1 Date: Sat, 15 Jul 2023 23:32:28 +0200 Subject: [PATCH] Moved all needed variables to .env added coloring to embeds after application finished --- bot.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bot.py b/bot.py index a6da707..b1ca913 100644 --- a/bot.py +++ b/bot.py @@ -12,9 +12,10 @@ load_dotenv() TOKEN = os.getenv("TOKEN") SERVER_NAME = os.getenv("SERVER_NAME") +CHANNEL_ID = os.getenv("CHANNEL_ID") bot = discord.Bot(intents=discord.Intents.all()) -channel_id = 867010119127400458 +channel_id = int(CHANNEL_ID) questions = { 1: "What is your Minecraft username?", @@ -34,7 +35,7 @@ async def on_ready(): bot.add_view(ApplicationButtonsView()) print(f"Logged in as {bot.user}") -@bot.slash_command(description = "Command used to apply", guild_ids = [866630736445702184]) +@bot.slash_command(description = "Command used to apply") async def apply(ctx): message = ctx.message @@ -143,10 +144,16 @@ class ApplicationModal(discord.ui.Modal): await interaction.response.send_message(content="Application accepted", ephemeral=True) role = get(interaction.message.guild.roles, name="CreatTopian") await discord.utils.get(interaction.message.guild.members, id=int(user_id)).add_roles(role) + emb = interaction.message.embeds[0] + emb.colour = discord.Colour.green() + await interaction.followup.edit_message(message_id = interaction.message.id, embeds=[emb]) if self.action == "dec": user = await bot.get_user(user_id).create_dm() await user.send(f"You have been declined access to the CreatTopia Minecraft server.") await user.send(f"Reason: {reason}") await interaction.response.send_message(content="Application declined", ephemeral=True) + emb = interaction.message.embeds[0] + emb.colour = discord.Colour.red() + await interaction.followup.edit_message(message_id = interaction.message.id, embeds=[emb]) bot.run(TOKEN) \ No newline at end of file