1
- import PIL .ImageDraw
2
-
3
- def textsize (self : PIL .ImageDraw .ImageDraw , * args , ** kwargs ):
4
- x , y , w , h = self .textbbox ((0 , 0 ), * args , ** kwargs )
5
- return w , h
6
-
7
- # Monkeypatch fix for https://github.com/flopp/py-staticmaps/issues/39
8
- PIL .ImageDraw .ImageDraw .textsize = textsize
9
-
10
1
import io
11
2
import math
12
3
import random
13
4
import re
14
5
6
+ import PIL .ImageDraw
15
7
import s2sphere
16
8
import staticmaps
17
9
from nio import AsyncClient , UploadResponse
@@ -20,6 +12,15 @@ def textsize(self: PIL.ImageDraw.ImageDraw, *args, **kwargs):
20
12
from plugins .base_plugin import BasePlugin
21
13
22
14
15
+ def textsize (self : PIL .ImageDraw .ImageDraw , * args , ** kwargs ):
16
+ x , y , w , h = self .textbbox ((0 , 0 ), * args , ** kwargs )
17
+ return w , h
18
+
19
+
20
+ # Monkeypatch fix for https://github.com/flopp/py-staticmaps/issues/39
21
+ PIL .ImageDraw .ImageDraw .textsize = textsize
22
+
23
+
23
24
class TextLabel (staticmaps .Object ):
24
25
def __init__ (self , latlng : s2sphere .LatLng , text : str , fontSize : int = 12 ) -> None :
25
26
staticmaps .Object .__init__ (self )
@@ -218,7 +219,11 @@ async def send_room_image(
218
219
await client .room_send (
219
220
room_id = room_id ,
220
221
message_type = "m.room.message" ,
221
- content = {"msgtype" : "m.image" , "url" : upload_response .content_uri , "body" : "image.png" },
222
+ content = {
223
+ "msgtype" : "m.image" ,
224
+ "url" : upload_response .content_uri ,
225
+ "body" : "image.png" ,
226
+ },
222
227
)
223
228
224
229
0 commit comments