File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -190,30 +190,38 @@ async def discord_runner():
190190 try :
191191 # pylint: disable=E1101
192192 async with websockets .connect (
193- "wss://"
194- + misskey_client .address
195- + "/streaming"
196- + "?i="
197- + misskey_client .token
193+ "wss://"
194+ + misskey_client .address
195+ + "/streaming"
196+ + "?i="
197+ + misskey_client .token
198198 ) as ws :
199199 await ws .send (
200200 json .dumps (
201- {"type" : "connect" , "body" : {"channel" : "main" , "id" : "main" }}
201+ {
202+ "type" : "connect" ,
203+ "body" : {"channel" : "main" , "id" : "main" },
204+ }
202205 )
203206 )
204207 while True :
205208 data = json .loads (await ws .recv ())
206- if data ["type" ] == "channel" and data ["body" ]["type" ] == "mention" :
209+ if (
210+ data ["type" ] == "channel"
211+ and data ["body" ]["type" ] == "mention"
212+ ):
207213 note = data ["body" ]["body" ]
208214 host = note ["user" ].get ("host" )
209215 mentions = note .get ("mentions" )
210216 if (
211- (host is None or host == conf .MISSKEY_DOMAIN )
212- and mentions
213- and misskey_client .i ()["id" ] in mentions
217+ (host is None or host == conf .MISSKEY_DOMAIN )
218+ and mentions
219+ and misskey_client .i ()["id" ] in mentions
214220 ):
215221 analyze .analyze_message (
216- note ["text" ].replace ("\xa0 " , " " ).split (" " , 1 )[1 ]
222+ note ["text" ]
223+ .replace ("\xa0 " , " " )
224+ .split (" " , 1 )[1 ]
217225 )(MisskeyClient (misskey_client , note ))
218226 except websockets .ConnectionClosedError :
219227 time .sleep (1 )
You can’t perform that action at this time.
0 commit comments