Ignore messages received before the bot is fully set up
This commit is contained in:
parent
740d14ef72
commit
ad7e0f11ac
@ -6,10 +6,11 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
import functools
|
||||||
|
|
||||||
import botconfig
|
import botconfig
|
||||||
import src.settings as var
|
import src.settings as var
|
||||||
from src import decorators, wolfgame, channels, hooks, users, errlog as log, stream_handler as alog
|
from src import decorators, wolfgame, events, channels, hooks, users, errlog as log, stream_handler as alog
|
||||||
from src.messages import messages
|
from src.messages import messages
|
||||||
from src.utilities import reply
|
from src.utilities import reply
|
||||||
|
|
||||||
@ -106,6 +107,14 @@ def connect_callback(cli):
|
|||||||
|
|
||||||
ping_server_timer(cli)
|
ping_server_timer(cli)
|
||||||
|
|
||||||
|
def setup_handler(evt, var, target):
|
||||||
|
target.client.command_handler["privmsg"] = on_privmsg
|
||||||
|
target.client.command_handler["notice"] = functools.partial(on_privmsg, notice=True)
|
||||||
|
|
||||||
|
events.remove_listener("who_end", setup_handler)
|
||||||
|
|
||||||
|
events.add_listener("who_end", setup_handler)
|
||||||
|
|
||||||
def mustregain(cli, server, bot_nick, nick, msg):
|
def mustregain(cli, server, bot_nick, nick, msg):
|
||||||
nonlocal regaincount
|
nonlocal regaincount
|
||||||
|
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
# THE SOFTWARE.
|
# THE SOFTWARE.
|
||||||
|
|
||||||
import traceback
|
import traceback
|
||||||
import functools
|
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -53,8 +52,8 @@ from src import handler
|
|||||||
def main():
|
def main():
|
||||||
src.plog("Connecting to {0}:{1}{2}".format(botconfig.HOST, "+" if botconfig.USE_SSL else "", botconfig.PORT))
|
src.plog("Connecting to {0}:{1}{2}".format(botconfig.HOST, "+" if botconfig.USE_SSL else "", botconfig.PORT))
|
||||||
cli = IRCClient(
|
cli = IRCClient(
|
||||||
{"privmsg": handler.on_privmsg,
|
{"privmsg": lambda *s: None,
|
||||||
"notice": functools.partial(handler.on_privmsg, notice=True),
|
"notice": lambda *s: None,
|
||||||
"": handler.unhandled},
|
"": handler.unhandled},
|
||||||
host=botconfig.HOST,
|
host=botconfig.HOST,
|
||||||
port=botconfig.PORT,
|
port=botconfig.PORT,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user