Added permission requirement for setup command

main
Anorak_1 2023-08-09 22:54:38 +02:00
parent 1617dbb422
commit 7631fcf1fd
1 changed files with 9 additions and 1 deletions

10
bot.py
View File

@ -7,6 +7,7 @@ import json
from dotenv import load_dotenv
from discord.ui import Modal, InputText
from discord.utils import get
from discord.ext import commands
from dbutil import MessageDB
load_dotenv()
@ -151,7 +152,7 @@ class ApplicationModal(discord.ui.Modal):
view.disable_all_items()
await interaction.followup.edit_message(message_id = interaction.message.id, view = view)
@commands.has_permissions(administrator=True)
@bot.slash_command(description = "Command used to set up the application prompt")
async def setup(ctx):
embed = discord.Embed(title="**Start your application!**")
@ -160,6 +161,13 @@ async def setup(ctx):
await ctx.response.send_message("Message set up", ephemeral=True)
await ctx.channel.send(embeds=[embed], view=appStartView)
@setup.error
async def on_application_command_error(ctx, error):
if isinstance(error, commands.MissingPermissions):
await ctx.respond("You need Administrator permissions to use this command", ephemeral=True)
else:
raise error
class ApplicationStartButtonView(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)