Skip to content

OpenRobot-Packages/JeyyAPI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jeyyapi (async)

Async python wrapper for JeyyAPI

Example usage

# import JeyyAPIClient
from jeyyapi import JeyyAPIClient

# Create JeyyAPICLient instance
client = JeyyAPIClient()

# fetch from `hearts` endpoint with its appropriate kwargs parameter
# returns io.BytesIO for image and discord endpoints
image = await client.hearts(image_url='IMAGE_URL', rainbow=True)

spotify command example on discord.py (2.0)

from jeyyapi import JeyyAPIClient

client = JeyyAPIClient()

# requires presence intent
@bot.command()
async def spotify(ctx, member: discord.Member=None):
    member = member or ctx.author
    spotify = discord.utils.find(lambda a: isinstance(a, discord.Spotify), member.activities)
    
    if spotify is None:
        return await ctx.send(f"**{member}** is not listening or connected to Spotify.")
    
    image = await client.spotify_from_object(spotify)
    
    await ctx.send(f"> **{member}** is listening to **{spotify.title}**", file=discord.File(image, 'spotify.png'))

Close the client session with await client.close() if you didn't pass your own session

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%