K
K
Killir Vanya2292021-06-22 11:42:40
Python
Killir Vanya229, 2021-06-22 11:42:40

The bottom line is that a discord participant, if he writes numbers to the server nickname, then he gets an error, how to do it in the code?

I want that if a person wrote a nickname only with numbers (for example, 123, 77779999), then he would get an error that says that such a nickname is prohibited, but nothing happened to me

@bot.command(pass_context=True, aliases = ['ник', 'Nick', 'Ник','NICK','НИК'])
async def nick(ctx, *, nick = None):
    if nick in range(1,999999999999):
        return await ctx.send(embed = discord.Embed(title='Произошла ошибка!', color=error, description=f':error: Ваш ник {nick} содержит одни цифры!\nПричина: Они нарушаются пунктом 3.3!'))
    await ctx.send(embed = discord.Embed(title='Успешно! :Verifed:', description=f'Ты поменял свой никнейм на **{nick}**!', color=success))
    await ctx.author.edit(nick=nick)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
soremix, 2021-06-22
@VEYREN

if nick.isdigit()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question