a few more changes to irc worker stuff

This commit is contained in:
Thomas Steen Rasmussen 2017-07-03 19:46:49 +02:00
parent 5c689e4076
commit a527e0dd0f
4 changed files with 7 additions and 33 deletions

View file

@ -73,9 +73,13 @@ SCHEDULE_EVENT_NOTIFICATION_MINUTES=10
# irc bot settings
IRCBOT_CHECK_MESSAGE_INTERVAL_SECONDS=60
IRCBOT_NICK='mybot'
IRCBOT_SCHEDULE_ANNOUNCE_CHANNEL='#something'
IRCBOT_SERVER_HOSTNAME='irc.example.com'
IRCBOT_NICK='{{ django_ircbot_nickname }}'
IRCBOT_SERVER_HOSTNAME='{{ django_ircbot_server }}'
IRCBOT_SERVER_PORT=6697
IRCBOT_SERVER_USETLS=True
IRCBOT_CHANNELS={
'default': '{{ django_ircbot_default_channel }}',
'orga': '{{ django_ircbot_orga_channel }}',
'public': '{{ django_ircbot_public_channel }}'
}

View file

@ -1,30 +0,0 @@
from django.core.management.base import BaseCommand
from django.conf import settings
from django.utils import timezone
from time import sleep
import irc3, sys, asyncio
class Command(BaseCommand):
args = 'none'
help = 'Runs the BornHack IRC bot to announce talks and manage team channel permissions'
def output(self, message):
self.stdout.write('%s: %s' % (timezone.now().strftime("%Y-%m-%d %H:%M:%S"), message))
def handle(self, *args, **options):
self.output('IRC bot worker running...')
# connect to IRC
config = {
'nick': settings.IRCBOT_NICK,
'autojoins': [settings.IRCBOT_SCHEDULE_ANNOUNCE_CHANNEL],
'host': settings.IRCBOT_SERVER_HOSTNAME,
'port': settings.IRCBOT_SERVER_PORT,
'ssl': settings.IRCBOT_SERVER_USETLS,
'timeout': 30,
'includes': [
'ircbot.irc3module',
],
}
irc3.IrcBot(**config).run(forever=True)