-1

Right now I'm trying to ask my bot to check when I, AND ONLY I write a messageS it says words. But I don't know how to make discordpy see if i messaged or not, I assume I have to use message.author.id() method. Please help. :3

#MODULES

import discord
from discord.ext import commands
from discord.utils import get

#THE CODE

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

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return

    if message.author.id('MY ACTUAL USER ID'):
        await bot.say('words')


bot.run('MY BOT TOKEN')
River M.
  • 1
  • 2

1 Answers1

2

bot.say is deprecated from the old async branch. Either way, you also haven’t defined where it sends the message to. Make sure you aren’t using a string for your user id, it’s an int and can be passed without quotes.

Simply replace the 123... with yours or others id

if message.author.id('MY ACTUAL USER ID'): should be instead if message.author.id == 123456789:

@bot.event
async def on_message(message):
    if message.author == bot.user:
        return

    if message.author.id == 123456789:
        await message.channel.send('words')
Cohen
  • 2,375
  • 3
  • 16
  • 35