0

It says "x" is not accessed Pylance But I don't know why it used to work until now. If you can please help.

troll3=  ["troll" , "ulikemen" , "someone-is-in-my-house" , ";/","amogsus"]   

@client.command()
@commands.has_permissions(administrator=True)
async def nuke(ctx):
    guild = ctx.guild
    await ctx.author.send(f'fake nuke command lol {ctx.author.mention}')
    for x in range(5):
        time.sleep(1)
        await ctx.send(f'[+] role: {(random.choice(troll3))} has been created')
    try:
        for channel in guild.channels:
            await ctx.send(f'channel: {channel.name} was deleted')
    except:
        await ctx.send('g')

enter image description here

I have fixed the error by changing X to _ which has made the code work properly.

troll3=  ["troll" , "ulikemen" , "someone-is-in-my-house" , ";/","amogsus"]   
    
    @client.command()
    @commands.has_permissions(administrator=True)
    async def nuke(ctx):
        guild = ctx.guild
        await ctx.author.send(f'fake nuke command lol {ctx.author.mention}')
        for _ in range(5): # This has been solved. I switched x to _ and it works now.
            time.sleep(1)
            await ctx.send(f'[+] role: {(random.choice(troll3))} has been created')
        try:
            for channel in guild.channels:
                await ctx.send(f'channel: {channel.name} was deleted')
        except:
            await ctx.send('g')
Scripter
  • 13
  • 2
  • 9
  • 2
    What is your question? How to eliminate the warning message (hint: replace `x` with `_`) or why it used to work until now? – Selcuk Aug 23 '21 at 03:09
  • I don't know it was working until I added some more stuff to my bot. I deleted the stuff I added to my bot but yet it is still not working I have rewritten the code and it still will not work. I will try what you suggested and replace the x with `_` . – Scripter Aug 23 '21 at 03:27
  • Ok I have figured it out. The code will not run because the users dms are off, And switching `x` to `_` worked to thank you for the help it was gladly appreciated :D – Scripter Aug 23 '21 at 03:32

0 Answers0