Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import discord
- import win32gui
- from discord.ext import commands
- class SpotCheck():
- def __init__(self, bot):
- self.bot = bot
- self.spotwin = None
- self.bot.loop.create_task(self.check_spotify())
- def check_spotify(self):
- while not self.bot.is_closed():
- if self.bot.is_ready():
- self.spotwin = win32gui.FindWindow("SpotifyMainWindow", None)
- if self.spotwin:
- if win32gui.GetWindowText(self.spotwin).lower() != "spotify":
- await self.bot.change_presence(game="Playing Music")
- await asyncio.sleep(90)
- else:
- await asyncio.sleep(10)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement