TypeError: ‘coroutine’ object is not callable HELP PLS [closed]

I tried to make a discord.py bot, that makes a button that sends a message in dmyour text
You can try to tell me how i do this with something else.

import discord
from discord.ext import commands

TOKEN = ''
PREFIX = '.'
intents = discord.Intents().all()

bot = commands.Bot(command_prefix=PREFIX, intents=intents)

@bot.event
async def on_ready():
   print("bot connected")

@bot.command()
async def code( ctx ):
   await ctx.author.send ( '1234' )
   
class Menu(discord.ui.View):
   def __init__(self):
      super().__init__()
      self.value = None

   @discord.ui.button(label="Code", style=discord.ButtonStyle.green)
   async def menu1(self, interaction:discord.Interaction, button:discord.ui.Button):
      await interaction.user.send()("8888")

@bot.command()
async def menu(ctx):
   view = Menu()
   await ctx.reply(view=view)

bot.run(TOKEN)

I tried to make a discord.py bot, that makes a button that sends a message in dmyour text
You can try to tell me how i do this with something else.

  • 1

    Ok so a couple things. If it only takes one sentence to explain your problem, you need to expand more. Don’t duplicate the same sentence. Also, don’t put “HELP PLS” in the title. It can be seen as annoying by many.

    – 




Users do not have a .send() method. Users have a .create_dm() method, which creates a DMChannel object. This DMChannel object has a .send() method to send messages in the DM Channel.
Use this instead of the ctx.author.send('1234').

channel = await ctx.author.create_dm()
await channel.send('1234')

Leave a Comment