Lowered ctcp timeout
This commit is contained in:
parent
b970f38344
commit
c5d08d2c35
|
@ -14,14 +14,15 @@ class CTCP(Plugin):
|
||||||
requires = ['irc3.plugins.async',
|
requires = ['irc3.plugins.async',
|
||||||
'irc3.plugins.command']
|
'irc3.plugins.command']
|
||||||
|
|
||||||
|
TIMEOUT = 5
|
||||||
|
|
||||||
# noinspection PyMethodMayBeStatic
|
# noinspection PyMethodMayBeStatic
|
||||||
def _ctcp(self, name: str, nick: str, reply: str):
|
def _ctcp(self, name: str, nick: str, reply: str):
|
||||||
return '\x02[{}]\x02 {}: {}'.format(name.upper(), nick, reply)
|
return '\x02[{}]\x02 {}: {}'.format(name.upper(), nick, reply)
|
||||||
|
|
||||||
async def ctcp(self, name: str, mask: IrcString, args: DocOptDict):
|
async def ctcp(self, name: str, mask: IrcString, args: DocOptDict):
|
||||||
nick = args.get('<nick>', mask.nick)
|
nick = args.get('<nick>', mask.nick)
|
||||||
name = name.upper()
|
data = await self.bot.ctcp_async(nick, name.upper(), self.TIMEOUT)
|
||||||
data = await self.bot.ctcp_async(nick, name)
|
|
||||||
|
|
||||||
if not data or data['timeout']:
|
if not data or data['timeout']:
|
||||||
reply = 'timeout'
|
reply = 'timeout'
|
||||||
|
@ -54,15 +55,7 @@ class CTCP(Plugin):
|
||||||
unit = 's'
|
unit = 's'
|
||||||
reply = '{0:.3f} {1}'.format(delta, unit)
|
reply = '{0:.3f} {1}'.format(delta, unit)
|
||||||
|
|
||||||
return self._ctcp('PING', nick, reply)
|
return self._ctcp('ping', nick, reply)
|
||||||
|
|
||||||
@command
|
|
||||||
async def finger(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
|
||||||
"""Gets the client response for finger nick user via CTCP
|
|
||||||
|
|
||||||
%%finger [<nick>]
|
|
||||||
"""
|
|
||||||
return await self.ctcp('FINGER', mask, args)
|
|
||||||
|
|
||||||
@command
|
@command
|
||||||
async def time(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
async def time(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
|
@ -70,7 +63,7 @@ class CTCP(Plugin):
|
||||||
|
|
||||||
%%time [<nick>]
|
%%time [<nick>]
|
||||||
"""
|
"""
|
||||||
return await self.ctcp('TIME', mask, args)
|
return await self.ctcp('time', mask, args)
|
||||||
|
|
||||||
@command
|
@command
|
||||||
async def ver(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
async def ver(self, mask: IrcString, target: IrcString, args: DocOptDict):
|
||||||
|
@ -78,4 +71,4 @@ class CTCP(Plugin):
|
||||||
|
|
||||||
%%ver [<nick>]
|
%%ver [<nick>]
|
||||||
"""
|
"""
|
||||||
return await self.ctcp('VERSION', mask, args)
|
return await self.ctcp('version', mask, args)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user