dr.botzo/dr_botzo/dispatch/models.py
Brian S. Stephan 0641e1c062 dispatch: port to django REST framework
this moves the dispatcher functionality that used to be in the old
ircbot directly to django REST framework, which is more robust and
allows for cooler stuff down the road. this still retains the ability to
have the bot privmsg, that still happens over the XML-RPC interface,
this is just a more convenient frontend to that
2015-06-18 23:57:43 -05:00

31 lines
696 B
Python

"""Track dispatcher configurations."""
import logging
from django.db import models
log = logging.getLogger('dispatch.models')
class Dispatcher(models.Model):
"""Handle incoming API requests and do something with them."""
PRIVMSG_TYPE = 'privmsg'
FILE_TYPE = 'file'
TYPE_CHOICES = (
(PRIVMSG_TYPE, "IRC privmsg"),
(FILE_TYPE, "Write to file"),
)
key = models.CharField(max_length=16, unique=True)
type = models.CharField(max_length=16, choices=TYPE_CHOICES)
destination = models.CharField(max_length=200)
def __unicode__(self):
"""String representation."""
return u"{0:s} -> {1:s}".format(self.key, self.destination)