2015-05-09 18:56:26 -05:00
|
|
|
"""Start the IRC bot via Django management command."""
|
|
|
|
|
|
|
|
import logging
|
2015-05-12 20:45:18 -05:00
|
|
|
import signal
|
2015-05-09 18:56:26 -05:00
|
|
|
|
|
|
|
from django.core.management import BaseCommand
|
|
|
|
|
2015-05-09 20:03:55 -05:00
|
|
|
from ircbot.bot import IRCBot
|
2015-05-09 18:56:26 -05:00
|
|
|
|
|
|
|
|
|
|
|
log = logging.getLogger('ircbot')
|
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
"""Provide the command to start the IRC bot.
|
|
|
|
|
|
|
|
This will run until the bot disconnects and shuts down.
|
|
|
|
"""
|
|
|
|
|
|
|
|
help = "Start the IRC bot"
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
|
|
|
"""Start the IRC bot and spin forever."""
|
|
|
|
|
|
|
|
irc = IRCBot()
|
2015-05-12 20:45:18 -05:00
|
|
|
signal.signal(signal.SIGINT, irc.sigint_handler)
|
2015-05-09 18:56:26 -05:00
|
|
|
irc.start()
|