title: Pygame with discord bot
body: <pre><code>import discord
  import random
  import pygame
  import time
  
  client = discord.Client()
  white = (255,255,255)
  clock = pygame.time.Clock()
  green = (0,255,0)
  red =(255,0,0)
  black = (0,0,0)
  
  global song
  song = 0
  
  
  @client.event
  async def on_message(message):
  
          # we do not want the bot to reply to itself
      if message.author == client.user:
           return
       if message.content.startswith(''):
          while True:
              if song == 1:
  
                  await client.send_message(message.channel, ';;play https://www.youtube.com/watch?v=cUbFzEMQ2Fs')
  
              elif song == 2:
                  await  client.send_message(message.channel, ';;play https://www.youtube.com/watch?v=YlomIQF2zbI')
              else:
                  await client.send_message(message.channel, "HI")
                  pygame.quit()
  
  
  
  
  
  
  def interface():
  
  
  
      pygame.init()
      gameDisplay = pygame.display.set_mode((500, 500))
  
      def button(x, y, w, h, ac, ic, songs):
          mouse = pygame.mouse.get_pos()
          click = pygame.mouse.get_pressed()
          if x + w &gt; mouse[0] &gt; x and y + h &gt; mouse[1] &gt; y:
              pygame.draw.rect(gameDisplay, ac, (x, y, w, h))
              if click[0] == 1 and songs != 0:
  
          else:
              pygame.draw.rect(gameDisplay, ic, (x, y, w, h))
  
      while True:
          event = pygame.event.get()
          gameDisplay.fill(white)
          button(50, 50, 50, 50, red, green, 1)
          button(50, 50, 50, 50, red, green, 2)
  
          pygame.display.update()
          clock.tick(60)
  
  
  
  
  
  
  
  
  
  
  
  @client.event
  async def on_ready():
      print('Logged in as')
      print(client.user.name)
      print(client.user.id)
      print('------')
      interface()
      '''channel = client.get_channel('id')
      await client.join_voice_channel(channel)
      print('Bot should joined the Channel')'''
  
  
  client.run('token')
  </code></pre>
  
  <p>Does anyone have any suggestion on how to do it as im a bit stuck.
  I would like the bot say something when i click a button on the pygame display interface. Thank you for any help that you can give me,</p>