minicambio #2
This commit is contained in:
22
main.py
22
main.py
@@ -63,29 +63,31 @@ async def add(ctx, attr: str, user: discord.Option(choices=[os.environ['N1'], os
|
|||||||
|
|
||||||
|
|
||||||
@bot.command(description=f"Borrar una característica de {os.environ['N1']} o {os.environ['N2']} (sólo admins)")
|
@bot.command(description=f"Borrar una característica de {os.environ['N1']} o {os.environ['N2']} (sólo admins)")
|
||||||
async def delete(ctx, attr: discord.Option(choices=[os.environ['N1'], os.environ['N2']])):
|
async def delete(ctx, attr: str, user: discord.Option(choices=[os.environ['N1'], os.environ['N2']])):
|
||||||
channel = bot.get_channel(1153429735527948399)
|
msg = 0
|
||||||
msg = await channel.fetch_message(1153429808429158460)
|
|
||||||
role = discord.utils.get(ctx.guild.roles, name="Admin")
|
role = discord.utils.get(ctx.guild.roles, name="Admin")
|
||||||
foca = 518377522485002241
|
foca = 518377522485002241
|
||||||
if ctx.author.id == foca:
|
if ctx.author.id == foca or !(role not in ctx.author.roles or ctx.author.id == os.environ['AID'] or ctx.author.id == os.environ['JID']):
|
||||||
|
if user == os.environ['N1']:
|
||||||
|
channel = bot.get_channel(1166495380003889232)
|
||||||
|
msg = await channel.fetch_message(1167496435944652891)
|
||||||
|
|
||||||
|
elif user == os.environ['N2']:
|
||||||
|
channel = bot.get_channel(1153429735527948399)
|
||||||
|
msg = await channel.fetch_message(1153429808429158460)
|
||||||
|
|
||||||
await msg.edit(content=f'{msg.content.replace(f"{NL}- {attr}", "")}')
|
await msg.edit(content=f'{msg.content.replace(f"{NL}- {attr}", "")}')
|
||||||
await ctx.respond("Característica eliminada :(", ephemeral=True)
|
await ctx.respond("Característica eliminada :(", ephemeral=True)
|
||||||
await send_log(f"Característica eliminada: {attr} por {ctx.user}")
|
await send_log(f"Característica eliminada: {attr} por {ctx.user}")
|
||||||
return
|
return
|
||||||
|
|
||||||
if role not in ctx.author.roles or ctx.author.id == os.environ['AID'] or ctx.author.id == os.environ['JID']:
|
else:
|
||||||
await ctx.respond("No tienes permiso para hacerlo!", ephemeral=True)
|
await ctx.respond("No tienes permiso para hacerlo!", ephemeral=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
if attr.lower() not in msg.content.lower():
|
if attr.lower() not in msg.content.lower():
|
||||||
await ctx.respond("Característica no encontrada.", ephemeral=True)
|
await ctx.respond("Característica no encontrada.", ephemeral=True)
|
||||||
|
|
||||||
else:
|
|
||||||
await msg.edit(content=f'{msg.content.replace(f"{NL}- {attr}", "")}')
|
|
||||||
await ctx.respond("Característica eliminada :(", ephemeral=True)
|
|
||||||
await send_log(f"Característica eliminada: {attr} por {ctx.user}")
|
|
||||||
|
|
||||||
|
|
||||||
async def send_log(msg):
|
async def send_log(msg):
|
||||||
channel = bot.get_channel(1153800096761262152)
|
channel = bot.get_channel(1153800096761262152)
|
||||||
|
|||||||
Reference in New Issue
Block a user