'how to send messages with buttons in on_ready function? Python discord bot

I'm trying to make the bot send messages when a button is clicked in the on_ready function to detect if someone is in the voice channel or not. But it is not sending the messages when I click the button.

@bot.event
async def on_ready():
  print('bot online')
  await bot.get_channel(950176344984145960).send("This is a button test", components=[
     [Button(style=ButtonStyle.blue, label="Button 1")
    ])
  res = await bot.wait_for("button_click")
  if res.channel == 950176344984145960:

      if not res.message.author.voice:
          await bot.get_channel(950176344984145960).send("Voice empty ")
          return
      elif res.message.author.voice:
          await bot.get_channel(950176344984145960).send("In voice")
          return


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source