Brian S. Stephan 9540c98d18
add more development tools and start the test scaffolding
this runs with a basic model and even more basic test, but I'm not
committing those yet as I'm still playing with the model (lest I make 30
revisions right off the bat)

Signed-off-by: Brian S. Stephan <bss@incorporeal.org>
2024-05-05 23:03:23 -05:00

30 lines
810 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 add_arguments(self, parser):
"""Add arguments to the bot startup."""
parser.add_argument('server_name')
def handle(self, *args, **options):
"""Start the IRC bot and spin forever."""
self.stdout.write(self.style.NOTICE(f"Starting up {options['server_name']} bot"))
irc = IRCBot(options['server_name'])
signal.signal(signal.SIGINT, irc.sigint_handler)
irc.start()