[TASK] Implement rejoin on kick; improve Kick message implementation.
This commit is contained in:
parent
f5dba3f6ef
commit
b34817331e
5
bot.py
5
bot.py
|
@ -77,6 +77,7 @@ class IrcProtocol(ManagedProtocol):
|
||||||
super(IrcProtocol, self).connection_made(transport)
|
super(IrcProtocol, self).connection_made(transport)
|
||||||
self.send_msg(irc.User(self._config["ident"], self._config["realname"]))
|
self.send_msg(irc.User(self._config["ident"], self._config["realname"]))
|
||||||
self.send_msg(irc.Nick(self._config["nick"]))
|
self.send_msg(irc.Nick(self._config["nick"]))
|
||||||
|
self.nick = self._config["nick"]
|
||||||
|
|
||||||
def data_received(self, data):
|
def data_received(self, data):
|
||||||
super(IrcProtocol, self).data_received(data)
|
super(IrcProtocol, self).data_received(data)
|
||||||
|
@ -111,6 +112,10 @@ class IrcProtocol(ManagedProtocol):
|
||||||
text = msg.message.strip("\x01")
|
text = msg.message.strip("\x01")
|
||||||
if text.upper() == "VERSION":
|
if text.upper() == "VERSION":
|
||||||
self.send_msg(irc.Privmsg(msg.get("nick"), "\x01HalloWelt lustiger Client v0.0.1\x01"))
|
self.send_msg(irc.Privmsg(msg.get("nick"), "\x01HalloWelt lustiger Client v0.0.1\x01"))
|
||||||
|
if isinstance(msg, irc.Kick):
|
||||||
|
if msg.target == self.nick:
|
||||||
|
self.send_msg(irc.Join(msg.channel))
|
||||||
|
self.send_msg(irc.Privmsg(msg.channel, "Hey, das war nicht nett!"))
|
||||||
|
|
||||||
def ready(self):
|
def ready(self):
|
||||||
for channel in self._config["channels"]:
|
for channel in self._config["channels"]:
|
||||||
|
|
6
irc.py
6
irc.py
|
@ -177,7 +177,8 @@ class Kick(Message, metaclass=register_derivative):
|
||||||
})
|
})
|
||||||
def parse(self):
|
def parse(self):
|
||||||
self.source = self.get("subject")
|
self.source = self.get("subject")
|
||||||
self.target = self.get("params")[0]
|
self.channel = self.get("params")[0]
|
||||||
|
self.target = self.get("params")[1]
|
||||||
self.message = self.get("trailing")
|
self.message = self.get("trailing")
|
||||||
|
|
||||||
class Join(Message, metaclass=register_derivative):
|
class Join(Message, metaclass=register_derivative):
|
||||||
|
@ -219,7 +220,6 @@ class Mode(Message, metaclass=register_derivative):
|
||||||
self.usermode = False
|
self.usermode = False
|
||||||
self.source = self.get("nick")
|
self.source = self.get("nick")
|
||||||
self.subject = self.get("params")[0]
|
self.subject = self.get("params")[0]
|
||||||
print(self.get("params"))
|
|
||||||
if(self.source == self.subject):
|
if(self.source == self.subject):
|
||||||
"""Parsing user modes here."""
|
"""Parsing user modes here."""
|
||||||
self.usermode = True
|
self.usermode = True
|
||||||
|
@ -276,7 +276,5 @@ if __name__ == "__main__":
|
||||||
d = msg.__dict__
|
d = msg.__dict__
|
||||||
del d["data"]
|
del d["data"]
|
||||||
print(d)
|
print(d)
|
||||||
|
|
||||||
print()
|
print()
|
||||||
|
|
||||||
exit()
|
exit()
|
||||||
|
|
Loading…
Reference in New Issue