Answer the question
In order to leave comments, you need to log in
How do I do error handling in the invite command?
The bottom line is that the bot should give an error if the participant does not have invites on the server, the problem looks like this:
Here is my invite code:
@commands.command(name = "invites", aliases = ("check_invites", "invites_check", "приглашения"))
async def user_invites(self, ctx: commands.Context, member: discord.Member = None) -> None:
if member is None:
member = ctx.author
embed = discord.Embed(color=defualt)
for invite in await ctx.guild.invites():
if invite.inviter.id == member.id:
day_created = (datetime.now()-invite.created_at).days
day_text_created = day_member(invite.created_at)
embed.add_field(name = f"Код {invite.code}", value =
f"На: {invite.channel.mention}\n"
f"Зашло: {invite.uses}\n"
f"Создан: {day_created} {day_text_created}")
embed.set_author(name = f"Приглашения у {member.name}", icon_url = member.avatar_url)
await ctx.send(embed = embed)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question