mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-30 23:09:23 +01:00
parent
e7922be9fb
commit
c8f12f2ab1
@ -153,6 +153,22 @@ def modeServer(irc, numeric, target, modes):
|
||||
raise LookupError('No such PyLink PseudoClient exists.')
|
||||
_sendModes(irc, numeric, target, modes)
|
||||
|
||||
def messageClient(irc, numeric, target, text):
|
||||
"""<irc object> <client numeric> <text>
|
||||
|
||||
Sends PRIVMSG <text> from PyLink client <client numeric>."""
|
||||
if not utils.isInternalClient(irc, numeric):
|
||||
raise LookupError('No such PyLink PseudoClient exists.')
|
||||
_sendFromUser(irc, numeric, 'PRIVMSG %s :%s' % (target, text))
|
||||
|
||||
def noticeClient(irc, numeric, target, text):
|
||||
"""<irc object> <client numeric> <text>
|
||||
|
||||
Sends NOTICE <text> from PyLink client <client numeric>."""
|
||||
if not utils.isInternalClient(irc, numeric):
|
||||
raise LookupError('No such PyLink PseudoClient exists.')
|
||||
_sendFromUser(irc, numeric, 'NOTICE %s :%s' % (target, text))
|
||||
|
||||
def connect(irc):
|
||||
irc.start_ts = ts = int(time.time())
|
||||
irc.uidgen = {}
|
||||
|
6
utils.py
6
utils.py
@ -40,8 +40,10 @@ class TS6UIDGenerator():
|
||||
return uid
|
||||
|
||||
def msg(irc, target, text, notice=False):
|
||||
command = 'NOTICE' if notice else 'PRIVMSG'
|
||||
irc.proto._sendFromUser(irc, irc.pseudoclient.uid, '%s %s :%s' % (command, target, text))
|
||||
if notice:
|
||||
irc.proto.noticeClient(irc, irc.pseudoclient.uid, target, text)
|
||||
else:
|
||||
irc.proto.messageClient(irc, irc.pseudoclient.uid, target, text)
|
||||
|
||||
def add_cmd(func, name=None):
|
||||
if name is None:
|
||||
|
Loading…
Reference in New Issue
Block a user