mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-25 19:44:13 +01:00
Merge pull request #376 from Digital-Lemon/testing
Network: Added @uptime && Irc.startedAt attribute
This commit is contained in:
commit
c31b6ed5c6
@ -317,6 +317,18 @@ class Network(callbacks.Plugin):
|
|||||||
irc.reply(otherIrc.driver.__class__.__module__[8:])
|
irc.reply(otherIrc.driver.__class__.__module__[8:])
|
||||||
driver = wrap(driver, ['networkIrc'])
|
driver = wrap(driver, ['networkIrc'])
|
||||||
|
|
||||||
|
@internationalizeDocstring
|
||||||
|
def uptime(self, irc, msg, args, otherIrc):
|
||||||
|
"""[<network>]
|
||||||
|
|
||||||
|
Returns the time duration since the connection was established.
|
||||||
|
"""
|
||||||
|
network = otherIrc.network
|
||||||
|
now = time.time()
|
||||||
|
started = otherIrc.startedAt
|
||||||
|
irc.reply(_("I've been connected to %s for %s.") %
|
||||||
|
(network, utils.timeElapsed(now - started)))
|
||||||
|
uptime = wrap(uptime, ['networkIrc'])
|
||||||
|
|
||||||
Class = Network
|
Class = Network
|
||||||
|
|
||||||
|
@ -615,6 +615,7 @@ class Irc(IrcCommandDispatcher):
|
|||||||
self.zombie = False
|
self.zombie = False
|
||||||
world.ircs.append(self)
|
world.ircs.append(self)
|
||||||
self.network = network
|
self.network = network
|
||||||
|
self.startedAt = time.time()
|
||||||
self.callbacks = callbacks
|
self.callbacks = callbacks
|
||||||
self.state = IrcState()
|
self.state = IrcState()
|
||||||
self.queue = IrcMsgQueue()
|
self.queue = IrcMsgQueue()
|
||||||
|
Loading…
Reference in New Issue
Block a user