Moved all needed variables to .env
added coloring to embeds after application finishedmain
parent
8eb0ac2eac
commit
5a94b57399
11
bot.py
11
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)
|
Loading…
Reference in New Issue