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