C
C
crystaLL1me2020-08-29 07:52:39
Python
crystaLL1me, 2020-08-29 07:52:39

AttributeError: 'NoneType' object has no attribute 'send' in @client.command()?

In general, the most simple code that gives an error:

#addredm
@client.command()
@commands.has_any_role(729950835337068647, 729950921940795423, 729951156704509994, 729950838038200370, 729951436867108904, 729951576004755497)
async def mp_red(ctx):

  wmc_channel = client.get_channel(748679966361863485)
  await wmc_channel.send('11111')


Mistake :
await wmc_channel.send('11111')
AttributeError: 'NoneType' object has no attribute 'send'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dasehak, 2020-08-29
@dasehak

Try:

@client.command()
@commands.has_any_role(729950835337068647, 729950921940795423, 729951156704509994, 729950838038200370, 729951436867108904, 729951576004755497)
async def mp_red(ctx, guild: discord.Guild = None):

    wmc_channel = discord.utils.get(guild.channels, id = 748679966361863485)
    await wmc_channel.send('11111')

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question