Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. import discord
  2. import win32gui
  3. from discord.ext import commands
  4.  
  5. class SpotCheck():
  6. def __init__(self, bot):
  7. self.bot = bot
  8. self.spotwin = None
  9. self.bot.loop.create_task(self.check_spotify())
  10.  
  11. def check_spotify(self):
  12. while not self.bot.is_closed():
  13. if self.bot.is_ready():
  14. self.spotwin = win32gui.FindWindow("SpotifyMainWindow", None)
  15. if self.spotwin:
  16. if win32gui.GetWindowText(self.spotwin).lower() != "spotify":
  17. await self.bot.change_presence(game="Playing Music")
  18. await asyncio.sleep(90)
  19. else:
  20. await asyncio.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement