@@ -17,10 +17,19 @@ class AsyncPilmoji(BasePilmoji):
1717 """
1818 The synchronous emoji renderer.
1919 """
20- def __init__ (self , image : Image .Image , * , session : typing .Optional [ClientSession ] = None , loop : typing .Optional [asyncio .AbstractEventLoop ] = None , use_microsoft_emoji : bool = False ):
20+ def __init__ (
21+ self ,
22+ image : Image .Image ,
23+ * ,
24+ session : typing .Optional [ClientSession ] = None ,
25+ loop : typing .Optional [asyncio .AbstractEventLoop ] = None ,
26+ use_microsoft_emoji : bool = False ,
27+ render_discord_emoji : bool = True
28+ ):
2129 if not isinstance (image , Image .Image ):
2230 raise TypeError (f'Image must be of type Image, got { type (image ).__name__ !r} instead.' )
2331
32+ self .render_discord_emoji : bool = render_discord_emoji
2433 self .http : AsyncRequester = AsyncRequester (session = session , loop = loop , _microsoft = use_microsoft_emoji )
2534 self .image : Image .Image = image
2635 self .draw = ImageDraw .Draw (image )
@@ -84,7 +93,10 @@ async def text(self,
8493 if node ['type' ] == 'twemoji' :
8594 stream = await self .http .get_twemoji (content )
8695 else :
87- stream = await self .http .get_discord_emoji (content )
96+ stream = (
97+ await self .http .get_discord_emoji (content )
98+ if self .render_discord_emoji else None
99+ )
88100
89101 if not stream :
90102 self .draw .text ((x , y ), content , * args , ** kwargs )
0 commit comments