[Python] Using Python and discord.py to make a bot for Steam id verification

Discussão em 'Python' iniciado por Stack, Março 15, 2025.

  1. Stack

    Stack Membro Participativo

    I'm making a bot for Steam id verification.

    I do not know how to make it so that after clicking on the no user button, it returns to the line asking you to enter the id.

    @bot.event
    async def on_member_join(member: discord.Member):
    commandid = False
    memberchannel = await member.guild.create_text_channel(f'{member.display_name} verification') #create chat with user when this user join on the server
    button = Button(label="Start Verification", style=discord.ButtonStyle.green)

    async def button_callback(interaction):
    commandid = True
    await interaction.response.send_message('Please enter command "!verif" and enter your steam ID \nПожалуйста введите команду "!verif" и введите ваш стим ID')

    @bot.command(commandid)
    async def verif(ctx, arg):
    await memberchannel.send(f'https://stratz.com/player/{arg} \nThis is you? \nЭто вы?')

    yesbutton = Button(label="Yes", style=discord.ButtonStyle.green)
    async def yesbutton_callback(interaction):
    commandid = False
    await interaction.response.send_message('You complete verification \nВы прошли верификацию')
    infochannel = bot.get_channel(1341121813802913873)
    info = f"{ctx.author} = {arg}"
    await infochannel.send(info)
    time.sleep(0.5)
    await memberchannel.delete()
    channel = bot.get_channel(1341402650197102633)
    await channel.send(f"{member.display_name} join on the server") # send message when user join on the server


    yesbutton.callback = yesbutton_callback

    nobutton = Button(label="No", style=discord.ButtonStyle.red)
    async def nobutton_callback(interaction):
    await interaction.response.send_message("Let's try it again \nПопробуем ещё раз")


    nobutton.callback = nobutton_callback

    view = View()
    view.add_item(yesbutton)
    view.add_item(nobutton)
    await memberchannel.send(view=view)


    button.callback = button_callback

    view = View()
    view.add_item(button)
    await memberchannel.send(view=view)


    What part do I need to do next?

    Continue reading...

Compartilhe esta Página