add Server.send_part() that optionally awaits PART confirmation
This commit is contained in:
parent
a79958affd
commit
5892c9ff45
1 changed files with 13 additions and 1 deletions
|
@ -12,7 +12,8 @@ from .ircv3 import (CAPContext, sts_transmute, CAP_ECHO, CAP_SASL,
|
||||||
CAP_LABEL, LABEL_TAG)
|
CAP_LABEL, LABEL_TAG)
|
||||||
from .sasl import SASLContext, SASLResult
|
from .sasl import SASLContext, SASLResult
|
||||||
from .join_info import WHOContext
|
from .join_info import WHOContext
|
||||||
from .matching import ResponseOr, Responses, Response, ParamAny, ParamFolded
|
from .matching import (ResponseOr, Responses, Response, ParamAny, ParamFolded,
|
||||||
|
Nickname)
|
||||||
from .asyncs import MaybeAwait
|
from .asyncs import MaybeAwait
|
||||||
from .struct import Whois
|
from .struct import Whois
|
||||||
from .params import ConnectionParams, SASLParams, STSPolicy
|
from .params import ConnectionParams, SASLParams, STSPolicy
|
||||||
|
@ -244,6 +245,17 @@ class Server(IServer):
|
||||||
channels = await fut
|
channels = await fut
|
||||||
return channels[0]
|
return channels[0]
|
||||||
return MaybeAwait(_assure)
|
return MaybeAwait(_assure)
|
||||||
|
def send_part(self, name: str):
|
||||||
|
fut = self.send(build("PART", [name]))
|
||||||
|
|
||||||
|
async def _assure():
|
||||||
|
line = await self.wait_for(Response(
|
||||||
|
"PART",
|
||||||
|
[ParamFolded(name)],
|
||||||
|
source=Nickname(self.nickname_lower)
|
||||||
|
))
|
||||||
|
return
|
||||||
|
return MaybeAwait(_assure)
|
||||||
|
|
||||||
def send_joins(self,
|
def send_joins(self,
|
||||||
names: List[str],
|
names: List[str],
|
||||||
|
|
Loading…
Reference in a new issue