Не поместилось всё.
Команда инвентаря:
#Инвентарь
@bot.command(aliases=['inv'])
async def inventory(ctx):
role1=discord.utils.get(ctx.guild.roles, id=966041637618847794)
role2=discord.utils.get(ctx.guild.roles, id=966046291740217384)
br=discord.utils.get(ctx.guild.roles, id=969228629676535878)
emb=discord.Embed(timestamp=ctx.message.created_at, colour=discord.Color.from_rgb(255, 255, 255))
counter=0
if ctx.channel.id==955186277270048808:
for row in cursor.execute("SELECT roles FROM inv WHERE id = {}".format(ctx.author.id)):
if ctx.guild.get_role(row[0]) != None:
emb.set_author(name=f"{ctx.author.name} ✧ Инвентарь",
icon_url=ctx.author.avatar_url)
counter+=1
emb.add_field(name=f"{counter}. Роль",
value=f"{ctx.guild.get_role(row[0]).mention}",
inline=False)
else:
pass
await ctx.reply(embed=emb, mention_author=False)
#Equip (написан очень глупо, но до того, как его редактировать, хотя бы разобраться с порядковым ID)
@bot.command(aliases=['eq'])
async def equip(ctx, unit=None):
role1=discord.utils.get(ctx.guild.roles, id=966041637618847794)
role2=discord.utils.get(ctx.guild.roles, id=966046291740217384)
for row in cursor.execute("SELECT roles, idx FROM inv WHERE id = {}".format(ctx.author.id)).fetchall():
if unit == "1":
role=cursor.execute("SELECT roles FROM inv WHERE idx = {}".format(1))
if role not in ctx.author.roles:
await ctx.author.add_roles(role)
await ctx.reply(embed=discord.Embed(timestamp=ctx.message.created_at,
description="<a:Yes1:965581422121353216> Роль успешно надета.",
colour=discord.Color.from_rgb(255, 255, 255)
).set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url),
mention_author=False, delete_after=5)
await asyncio.sleep(5)
await ctx.message.delete()
else:
await ctx.reply(embed=discord.Embed(timestamp=ctx.message.created_at,
description="<:nonn:965626108387164221> Роль уже надета."
).set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url),
mention_author=False, delete_after=5)
await asyncio.sleep(5)
await ctx.message.delete()
elif unit == "2":
role=ctx.guild.get_role(row[0])
if role not in ctx.author.roles:
await ctx.author.add_roles(role)
await ctx.reply(embed=discord.Embed(timestamp=ctx.message.created_at,
description="<a:Yes1:965581422121353216> Роль успешно надета.",
colour=discord.Color.from_rgb(255, 255, 255)
).set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url),
mention_author=False, delete_after=5)
await asyncio.sleep(5)
await ctx.message.delete()
else:
await ctx.reply(embed=discord.Embed(timestamp=ctx.message.created_at,
description="<:nonn:965626108387164221> Роль уже надета."
).set_author(name=ctx.author.name, icon_url=ctx.author.avatar_url),
mention_author=False, delete_after=5)
await asyncio.sleep(5)
await ctx.message.delete()