diff --git a/DOCUMENTATION.md b/DOCUMENTATION.md index eb7db01..4c44024 100644 --- a/DOCUMENTATION.md +++ b/DOCUMENTATION.md @@ -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. @@ -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)* + --- --- --- diff --git a/sr_api/client.py b/sr_api/client.py index 2e2deb7..d9da08c 100644 --- a/sr_api/client.py +++ b/sr_api/client.py @@ -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!") @@ -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}) @@ -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) @@ -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, @@ -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.") @@ -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.")