dr.botzo/dr_botzo/ircbot/management/commands/runircbot.py
Brian S. Stephan c4bfcf3e1b add BotAdmin, IrcPlugin models
a lot of stuff in here around support for loading plugins from arbitrary
files. plugins have a basic amount of initialization and then hook into
the core IRC event system

it makes sense to have modules respond to regexes, so there's some
handler stuff for that --- it was the most popular way to do stuff in
the old version of the bot

we need to check that people trying to load plugins are admins, so
there's some stuff for that, too

the expectation is that many features from here are happen in plugins,
rather than modifying the core bot
2015-05-12 20:45:18 -05:00

28 lines
572 B
Python

"""Start the IRC bot via Django management command."""
import logging
import signal
from django.core.management import BaseCommand
from ircbot.bot import IRCBot
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()
signal.signal(signal.SIGINT, irc.sigint_handler)
irc.start()