mirror of
https://github.com/nichkara/InfinitumBotty.git
synced 2026-06-10 22:26:23 +02:00
Initalize repo
This commit is contained in:
24
FaustBot/Communication/JoinObservable.py
Normal file
24
FaustBot/Communication/JoinObservable.py
Normal file
@@ -0,0 +1,24 @@
|
||||
import _thread
|
||||
|
||||
from FaustBot.Communication.Observable import Observable
|
||||
|
||||
|
||||
class JoinObservable(Observable):
|
||||
def input(self, raw_data, connection):
|
||||
# ":nick!user@host" "JOIN" "#channel"
|
||||
# additional ignored arguments are put into "ign". This could be used
|
||||
# for http://ircv3.net/specs/extensions/extended-join-3.1.html in the
|
||||
# future.
|
||||
prefix, cmd, channel, *ign = raw_data.split(' ')
|
||||
hostmask = prefix.lstrip(':')
|
||||
nick, userhost = hostmask.split('!')
|
||||
user, host = userhost.split('@')
|
||||
|
||||
data = {'raw': raw_data, 'nick': nick, 'user': user, 'host': host,
|
||||
'channel': channel, 'raw_nick': hostmask}
|
||||
self.notify_observers(data, connection)
|
||||
|
||||
|
||||
def notify_observers(self, data, connection):
|
||||
for observer in self._observers:
|
||||
_thread.start_new_thread(observer.__class__.update_on_join, (observer, data, connection))
|
||||
Reference in New Issue
Block a user