AttributeError: ‘Client’ object has no attribute ‘send_message’ (Discord Bot)

You are probably running the rewrite version of discord.py, since the discord.Client object does not a have a send_message method.

To fix your problem you can just have it as:

async def test(author, message):
    await message.channel.send('I heard you! {0.name}'.format(author))

but for what i see you doing I reccomend using the commands extension

This makes creating a bot and commands for the bot much simpler, for example here is some code that does exactly the same as yours

from discord.ext import commands

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

@bot.command()
async def test(ctx):
    await ctx.send('I heard you! {0}'.format(ctx.author))

bot.run('token')

Leave a Comment