Skip to content

JeyyGit/jeyyapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jeyyapi (async)

Async python wrapper for JeyyAPI

Installation

$ pip install git+https://github.com/JeyyGit/jeyyapi.git

Example usage

# import JeyyAPIClient
from jeyyapi import JeyyAPIClient

# Create JeyyAPICLient instance
client = JeyyAPIClient('YOUR_API_KEY_HERE')

# 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('YOUR_API_KEY_HERE')

# 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

About

Python wrapper for JeyyAPI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages