4
0
mirror of https://github.com/jesopo/ircrobots synced 2024-06-14 12:16:37 +00:00
ircrobots/ircrobots/join_info.py
2020-04-28 11:45:46 +01:00

18 lines
568 B
Python

from typing import Dict, Iterable, List, Optional
from irctokens import build
from ircstates.numerics import *
from .contexts import ServerContext
from .matching import Response, ANY, Folded
class WHOContext(ServerContext):
async def ensure(self, channel: str):
if self.server.isupport.whox:
await self.server.send(self.server.prepare_whox(channel))
else:
await self.server.send(build("WHO", [channel]))
line = await self.server.wait_for(
Response(RPL_ENDOFWHO, [ANY, Folded(channel)])
)