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