mirror of
https://github.com/iio612/DEFENDER.git
synced 2026-02-13 11:14:23 +00:00
Update parse_privmsg, now it returns sender, reciever, channel objects and the message
This commit is contained in:
@@ -176,15 +176,13 @@ def create_new_clone(uplink: 'Clone', faker_instance: 'Faker', group: str = 'Def
|
||||
|
||||
def handle_on_privmsg(uplink: 'Clone', srvmsg: list[str]) -> None:
|
||||
|
||||
parser = uplink.Protocol.parse_privmsg(srvmsg)
|
||||
uid_sender = uplink.Irc.Utils.clean_uid(parser.get('uid_sender', None))
|
||||
senderObj = uplink.User.get_user(uid_sender)
|
||||
senderObj, recieverObj, channel, message = uplink.Protocol.parse_privmsg(srvmsg)
|
||||
|
||||
if senderObj is not None:
|
||||
if senderObj.hostname in uplink.Config.CLONE_LOG_HOST_EXEMPT:
|
||||
return
|
||||
senderMsg = parser.get('message', None)
|
||||
clone_obj = uplink.Clone.get_clone(parser.get('uid_reciever', None))
|
||||
senderMsg = message
|
||||
clone_obj = recieverObj
|
||||
|
||||
if clone_obj is None:
|
||||
return
|
||||
|
||||
@@ -62,13 +62,10 @@ def handle_on_mode(uplink: 'Defender', srvmsg: list[str]):
|
||||
|
||||
def handle_on_privmsg(uplink: 'Defender', srvmsg: list[str]):
|
||||
# ['@mtag....',':python', 'PRIVMSG', '#defender', ':zefzefzregreg', 'regg', 'aerg']
|
||||
sender = srvmsg[1].replace(':','')
|
||||
channel = srvmsg[3]
|
||||
message = srvmsg[4:]
|
||||
message[0] = message[0].replace(':', '')
|
||||
|
||||
if uplink.ModConfig.sentinel == 1 and srvmsg[3] != uplink.Config.SERVICE_CHANLOG:
|
||||
uplink.Protocol.send_priv_msg(uplink.Config.SERVICE_NICKNAME, f"{sender} say on {channel}: {' '.join(message)}", uplink.Config.SERVICE_CHANLOG)
|
||||
sender, reciever, channel, message = uplink.Protocol.parse_privmsg(srvmsg)
|
||||
if uplink.ModConfig.sentinel == 1 and channel.name != uplink.Config.SERVICE_CHANLOG:
|
||||
uplink.Protocol.send_priv_msg(uplink.Config.SERVICE_NICKNAME, f"{sender.nickname} say on {channel.name}: {' '.join(message)}", uplink.Config.SERVICE_CHANLOG)
|
||||
|
||||
action_on_flood(uplink, srvmsg)
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user