import discord
import asyncio

client = discord.Client()

@client.event
async def on_ready():
    print('Logged in as')
    print(client.user.name)
    print(client.user.id)
    print('------')

@client.event
async def on_message(message):
    if message.content.startswith('!test'):
        await client.send_message(message.channel, 'Hello world!')

client.run('paste_token_here')
import asyncio

import discord
from   discord.ext import commands



bot = commands.Bot(command_prefix='!', description='test')

@bot.event
async def on_ready():
    print('Logged in as')
    print(bot.user.name)
    print(bot.user.id)
    print('------')
    
@bot.command()
async def test():
    await bot.say('Hello World!')

bot.run('paste_token_here')

Switch to Bot object instead of Client
Switch to Bot object instead of Client

Better reflects examples in discord.py project
