S
S
Skirgan2020-08-09 13:51:57
Python
Skirgan, 2020-08-09 13:51:57

Error starting Discord.Python bot, what should I do?

I decided to make a simple bot. I wrote the code, connected it, entered the token and already started the launch, as an error was displayed at startup.
The code:

import discord
from discord.ext import commands

client = commands.Bot( command_prefix = '.')

@client.command()

async def Тест(ctx): #Тест
    await ctx.send('Бот готов к работе.')

client.run("Token_For_Bot")

Mistake:

Traceback (most recent call last):
  File "test.py", line 11, in <module>
    client.run("Token_For_Bot")
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 640, in run
    return future.result()
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 621, in runner
    await self.start(*args, **kwargs)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 585, in start
    await self.connect(reconnect=reconnect)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 499, in connect
    await self._connect()
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\client.py", line 463, in _connect
    await self.ws.poll_event()
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\gateway.py", line 471, in poll_event
    await self.received_message(msg)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\gateway.py", line 425, in received_message
    func(data)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\state.py", line 750, in parse_guild_create
    guild = self._get_create_guild(data)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\state.py", line 725, in _get_create_guild
    guild._from_data(data)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\guild.py", line 297, in _from_data
    self._sync(guild)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\guild.py", line 328, in _sync
    self._add_channel(CategoryChannel(guild=self, data=c, state=self._state))
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\channel.py", line 726, in __init__
    self._update(guild, data)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\channel.py", line 737, in _update
    self._fill_overwrites(data)
  File "C:\Users\Alexey\AppData\Local\Programs\Python\Python37-32\lib\site-packages\discord\abc.py", line 294, in _fill_overwrites
    self._overwrites.append(_Overwrites(id=overridden_id, **overridden))
TypeError: __new__() got an unexpected keyword argument 'deny_new'

I connected the bot to another server and it worked. But maybe someone knows how to avoid this error when connecting to the server I need? (PS For some reason, I need to connect the bot to this server, I tried to make a server template and connect the bot to it, still the same error).

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Maxim Nevzorov, 2020-08-09
@Skirgan

https://qna.habr.com/answer?answer_id=1699219#answ...

A
Anton Rosin, 2020-08-09
@Rosin886

Inside quotes: client.run("")
you need to paste the bot token obtained here: https://discord.com/developers/applications

R
Rostislavcheg, 2020-08-09
@Rostislavcheg

import discord
from discord.ext import commands
client = commands.Bot( command_prefix = '.')
@client.command()
async def Test(ctx):
#Test await ctx.send('Bot is ready to go.')
client. run("Token for bot")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question