Arash
Arash

Reputation: 13

Error in discord.py : TypeError: unexpected keyword argument(s) ['Bot']

I got an error like this:

Traceback (most recent call last):
  File "E:\AS-TEAM\cp\public\hello.py", line 22, in <module>
    bot.run("thisistokensorry:(", Bot=False)
  File "E:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 723, in run   
    return future.result()
  File "E:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "E:\Users\User\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\client.py", line 663, in start
    raise TypeError("unexpected keyword argument(s) %s" % list(kwargs.keys()))
TypeError: unexpected keyword argument(s) ['Bot']

So, how do I fix it? The python code is:

import discord
import time
from discord.ext import commands

bot = commands.Bot(command_prefix='$')

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return
    if message.content.find("!Hello") != -1:
        await message.channel.send('Hi')
    if message.content.lower().startswith('message everyone'):
        for guild in bot.guilds:
            await time.sleep(.25)
            members = guild.members
            for member in members:
                if member.bot is True:
                    continue
                await time.sleep(.25)
                channel = await member.create_dm()
                await channel.send('sup')

bot.run("thisistokensorry:(", Bot=False)

And, I need help with it. because I want it fixed for the first time! please fix it

Upvotes: 1

Views: 4155

Answers (1)

Ratery
Ratery

Reputation: 2917

You should use bot=False instead of Bot=False because it's valid name of kwarg.

Upvotes: 2

Related Questions