00af109e2f
* add flake8 to pre-commit config, and fixup many things to make flake8 happy * add isort and sort all imports, add to pre-commit and requirements
21 lines
513 B
Python
21 lines
513 B
Python
import logging
|
|
from datetime import timedelta
|
|
|
|
from django.utils import timezone
|
|
|
|
logger = logging.getLogger("bornhack.%s" % __name__)
|
|
|
|
|
|
def add_irc_message(target, message, timeout=10):
|
|
"""
|
|
Convenience function for adding OutgoingIrcMessage objects.
|
|
Defaults to a message timeout of 10 minutes
|
|
"""
|
|
from .models import OutgoingIrcMessage
|
|
|
|
OutgoingIrcMessage.objects.create(
|
|
target=target,
|
|
message=message,
|
|
timeout=timezone.now() + timedelta(minutes=timeout),
|
|
)
|