Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,20 @@ Generate a fake youtube comment.

**Return type:** [Image](https://github.com/iDutchy/sr_api/blob/master/DOCUMENTATION.md#image "Image object attributes") *(object)*

### client.tweet(avatar, username, display_name, comment)
---
Generate a fake tweet.

**WARNING:** The Image.url returned by this function will very likely not embed! You will have to use Image.read to get the bytes object and work from there!

**Parameters:**\
**- avatar** *(string)*: The avatar you want to use.\
**- username** *(string)*: The username for the tweet.\
**- display_name** *(string)*: The display name for the tweet.\
**- comment** *(string)*: The content of the tweet.

**Return type:** [Image](https://github.com/iDutchy/sr_api/blob/master/DOCUMENTATION.md#image "Image object attributes") *(object)*

### client.view_color(color)
---
View a color.
Expand Down Expand Up @@ -254,6 +268,18 @@ Convert HEX to RGB

**Return type:** dict ("r", "g", "b")

### client.color_filter(self, avatar, color)
---
Apples a color filter on an image.

**WARNING:** The Image.url returned by this function will very likely not embed! You will have to use Image.read to get the bytes object and work from there!

**Parameters:**\
**- avatar** *(string)*: The avatar you want to use.\
**- color** *(string)*: The color you want to use.

**Return type:** [Image](https://github.com/iDutchy/sr_api/blob/master/DOCUMENTATION.md#image "Image object attributes") *(object)*

---
---
---
Expand Down
17 changes: 13 additions & 4 deletions sr_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ async def get_joke(self):
def filter(self, option, url):
options = (
'greyscale', 'invert', 'invertgreyscale', 'brightness', 'threshold', 'sepia', 'red', 'green', 'blue', 'blurple',
'pixelate', 'blur', 'gay', 'glass', 'wasted', 'triggered', 'spin', 'jail', 'blurple2')
'pixelate', 'blur', 'gay', 'glass', 'wasted', 'triggered', 'spin', 'jail', 'blurple2', 'comrade', 'passed')

if option.lower() not in options:
raise InputError(option.lower() + " is not a valid option!")
Expand All @@ -221,6 +221,10 @@ def youtube_comment(self, avatar, username, comment):
url = self.srapi_url("canvas/youtube-comment", {"avatar": avatar, "username": username, "comment": comment})
return Image(self._http_client, url)

def tweet(self, avatar, username, display_name, comment):
url = self.srapi_url("canvas/tweet", {"avatar": avatar, "username": username, "displayname": display_name, "comment": comment})
return Image(self._http_client, url)

def view_color(self, color):
color = color.replace("#", '')
url = self.srapi_url("canvas/colorviewer", {"hex": color})
Expand All @@ -235,6 +239,11 @@ async def hex_to_rgb(self, color_hex):
response = await self._http_client.get(self.srapi_url("canvas/rgb", {"hex": color_hex}))
return dict(response)

def color_filter(self, avatar, color):
color = color.replace("#", '')
url = self.srapi_url("canvas/color", {"avatar": avatar, "color": color})
return Image(self._http_client, url)

def lolice(self, avatar):
url = self.srapi_url("canvas/lolice", {"avatar": avatar})
return Image(self._http_client, url)
Expand All @@ -260,7 +269,7 @@ async def check_key(self):

return res

def welcome(template, background, action_type, avatar, username, discriminator, guild_name, text_color, member_count):
def welcome(self, template, background, action_type, avatar, username, discriminator, guild_name, text_color, member_count):

url = self.srapi_url("welcome/img/" + str(template) + '/' + background, {
"type": action_type,
Expand All @@ -274,7 +283,7 @@ def welcome(template, background, action_type, avatar, username, discriminator,

return Image(self._http_client, url)

def premium_welcome(template, action_type, avatar, username, discriminator, guild_name, text_color, member_count, background_image):
def premium_welcome(self, template, action_type, avatar, username, discriminator, guild_name, text_color, member_count, background_image):
if self.key is None:
raise PremiumOnly("This endpoint can only be used by premium users.")

Expand All @@ -291,7 +300,7 @@ def premium_welcome(template, action_type, avatar, username, discriminator, guil

return Image(self._http_client, url)

def rank_card(template, username, avatar, discriminator, level, current_xp, needed_xp, rank, background_image, background_color=None, text_color=None, current_xp_bar_color=None, bar_color=None):
def rank_card(self, template, username, avatar, discriminator, level, current_xp, needed_xp, rank, background_image, background_color=None, text_color=None, current_xp_bar_color=None, bar_color=None):
if self.key is None:
raise PremiumOnly("This endpoint can only be used by premium users.")

Expand Down