permabots.models package¶
Submodules¶
permabots.models.base module¶
-
class
permabots.models.base.
PermabotsModel
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
-
PermabotsModel.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
PermabotsModel.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
PermabotsModel.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
PermabotsModel.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
permabots.models.bot module¶
-
class
permabots.models.bot.
Bot
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Model representing a Permabot. Its behavior is shared by all service integrations.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- owner_id (ForeignKey) – User who owns the bot
- name (CharField) – Name for the bot
- telegram_bot_id (OneToOneField) – Telegram Bot
- kik_bot_id (OneToOneField) – Kik Bot
- messenger_bot_id (OneToOneField) – Messenger Bot
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Bot.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Bot.
env_vars
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Bot.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
Bot.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
Bot.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
Bot.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
Bot.
handle_hook
(hook, data)[source]¶ Process notification hook.
Parameters: - hook (Hook
Hook
) – Notification hook to process - data – JSON data from webhook POST
- hook (Hook
-
Bot.
handle_message
(message, bot_service)[source]¶ Process incoming message generating a response to the sender.
Parameters: - message – Generic message received from provider
- bot_service (IntegrationBot
IntegrationBot
) – Service Integration
Note
Message content will be extracted by IntegrationBot
-
Bot.
handlers
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Bot.
hooks
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Bot.
kik_bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Bot.
messenger_bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Bot.
objects
= <django.db.models.manager.Manager object>¶
-
Bot.
owner
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Bot.
states
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Bot.
telegram_bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
class
permabots.models.bot.
IntegrationBot
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Abstract class to integrate new instant messaging service.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- enabled (BooleanField) – Enable/disable telegram bot
-
class
Meta
[source]¶ -
abstract
= False¶
-
verbose_name
= <django.utils.functional.__proxy__ object>¶
-
verbose_name_plural
= <django.utils.functional.__proxy__ object>¶
-
-
IntegrationBot.
build_keyboard
(keyboard)[source]¶ From an arrays of strings generated specific keyboard for integration
Parameters: keyboard – list(strings) Returns: specific keyboard
-
IntegrationBot.
create_chat_state
(message, target_state, context)[source]¶ Crate specific chat state modelling for the integration. It is called only when first chat interaction is performed by a user.
Parameters: - message – Message from the provider
- target_state – State to set
- context – Processing generated in the processing
-
IntegrationBot.
get_chat_id
(message)[source]¶ Extract chat identifier from service message.
Parameters: message – Message from provider Returns: chat identifier
-
IntegrationBot.
get_chat_state
(message)[source]¶ Each integration has its own chat state model. Implement this method to obtain it from message
Parameters: message – Message from provider Returns: generic chat state
-
IntegrationBot.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
IntegrationBot.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
IntegrationBot.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
IntegrationBot.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
IntegrationBot.
hook_id
¶ Identifier to generate webhook url i.e. primary key UUID
Returns: Identifier Return type: string
-
IntegrationBot.
hook_url
¶ Name of the view to resolve url. i.e. permabots:telegrambot :returns: Named view
-
IntegrationBot.
identity
¶ Some service identifier to attach in processing context i.e. telegram.
Returns: Service Indentifier Return type: string
-
IntegrationBot.
init_bot
()[source]¶ Implement this method to perform some specific intialization to the bot
-
IntegrationBot.
message_text
(message)[source]¶ Extract text message from generic message :param message: Message from provider :returns: text from message :rtype: string
-
IntegrationBot.
null_url
¶ Return a none URL to remove webhook. i.e.: None
Returns: None url Note
Some providers API accepts None but others need a real url. Use https://example.com in this case
-
IntegrationBot.
send_message
(chat_id, text, keyboard, reply_message=None, user=None)[source]¶ Send message with the a response generated.
Parameters: - chat_id – Identifier for the chat
- text – Text response
- keyboard – Keyboard response
- reply_message – Message to reply
- user – When no replying in some providers is not enough with chat_id
Note
Each provider has its own limits for texts and keyboards buttons. Implement here how to split a response to several messages.
-
class
permabots.models.bot.
KikBot
(*args, **kwargs)[source]¶ Bases:
permabots.models.bot.IntegrationBot
Kik integration.
Permabots sets webhook. Only requires api_key and username from Kik provider.
Follow Kik instructons to create a bot and obtain username and api_key https://dev.kik.com/.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- enabled (BooleanField) – Enable/disable telegram bot
- api_key (CharField) – Kik bot api key
- username (CharField) – Kik bot user name
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
KikBot.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
KikBot.
bot
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
KikBot.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
KikBot.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
KikBot.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
KikBot.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
KikBot.
hook_id
¶
-
KikBot.
hook_url
¶
-
KikBot.
identity
¶
-
KikBot.
null_url
¶
-
KikBot.
objects
= <django.db.models.manager.Manager object>¶
-
class
permabots.models.bot.
MessengerBot
(*args, **kwargs)[source]¶ Bases:
permabots.models.bot.IntegrationBot
Facebook Messenger integration.
Permabots only uses Page Access Token but webhook is not set. It mus be set manually in Facebook dev platform using UUID generated as id of the messenger bot after creation in Permabots.
This bot is used to Verify Token and generate url https://domain/processing/messengerbot/permabots_messenger_bot_id/
Read Messenger documentation <https://developers.facebook.com/docs/messenger-platform/quickstart> _.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- enabled (BooleanField) – Enable/disable telegram bot
- token (CharField) – Messenger token
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MessengerBot.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
MessengerBot.
bot
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
MessengerBot.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
MessengerBot.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
MessengerBot.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
MessengerBot.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
MessengerBot.
hook_id
¶
-
MessengerBot.
hook_url
¶
-
MessengerBot.
identity
¶
-
MessengerBot.
messages
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
MessengerBot.
null_url
¶
-
MessengerBot.
objects
= <django.db.models.manager.Manager object>¶
-
class
permabots.models.bot.
TelegramBot
(*args, **kwargs)[source]¶ Bases:
permabots.models.bot.IntegrationBot
Telegram integration.
Permabots only requires token to set webhook and obtain some bot info.
Follow telegram instructions to create a bot and obtain its token https://core.telegram.org/bots#botfather.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- enabled (BooleanField) – Enable/disable telegram bot
- token (CharField) – Token provided by Telegram API https://core.telegram.org/bots
- user_api_id (OneToOneField) – Telegram API info. Automatically retrieved from Telegram
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
TelegramBot.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
TelegramBot.
bot
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
TelegramBot.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
TelegramBot.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
TelegramBot.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
TelegramBot.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
TelegramBot.
hook_id
¶
-
TelegramBot.
hook_url
¶
-
TelegramBot.
identity
¶
-
TelegramBot.
null_url
¶
-
TelegramBot.
objects
= <django.db.models.manager.Manager object>¶
-
TelegramBot.
updates
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
TelegramBot.
user_api
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
permabots.models.environment_vars module¶
-
class
permabots.models.environment_vars.
EnvironmentVar
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Environment Variable associated to a Bot.
Use it in contexts as {{ env.variable_key }}.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- bot_id (ForeignKey) – Bot which variable is attached.
- key (CharField) – Name of the variable
- value (CharField) – Value of the variable
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
EnvironmentVar.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
EnvironmentVar.
bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
EnvironmentVar.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
EnvironmentVar.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
EnvironmentVar.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
EnvironmentVar.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
EnvironmentVar.
objects
= <django.db.models.manager.Manager object>¶
permabots.models.handler module¶
-
class
permabots.models.handler.
AbstractParam
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Abstract parameter for
Request
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- key (CharField) – Name of the parameter
- value_template (CharField) – Value template of the parameter. In jinja2 format. http://jinja.pocoo.org/
-
class
Meta
[source]¶ -
abstract
= False¶
-
verbose_name
= <django.utils.functional.__proxy__ object>¶
-
verbose_name_plural
= <django.utils.functional.__proxy__ object>¶
-
-
AbstractParam.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
AbstractParam.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
AbstractParam.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
AbstractParam.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
class
permabots.models.handler.
Handler
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Model to handler conversation message
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- bot_id (ForeignKey) – Bot which Handler is attached to
- name (CharField) – Name for the handler
- pattern (CharField) – Regular expression the Handler will be triggered. Using https://docs.python.org/2/library/re.html#regular-expression-syntax
- request_id (OneToOneField) – Request the Handler processes
- response_id (OneToOneField) – Template the handler uses to generate response
- enabled (BooleanField) – Enable/disable handler
- target_state_id (ForeignKey) – This state will be set when handler ends processing
- priority (IntegerField) – Set priority execution. Higher value higher priority
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Handler.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Handler.
bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Handler.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
Handler.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
Handler.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
Handler.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
Handler.
objects
= <django.db.models.manager.Manager object>¶
-
Handler.
process
(bot, message, service, state_context, **pattern_context)[source]¶ Process conversation message.
- Generates context
- service: name of integration service
- state_context: historic dict of previous contexts. identified by state
- pattern: url pattern dict
- env: dict of environment variables associated to this bot
- message: provider message
- emoji: dict of emojis use named notation with underscores <http://apps.timwhitlock.info/emoji/tables/unicode> _.
Process request (if required)
Generates response. Text and Keyboard
Prepare target_state and context for updating chat&state info
Parameters: - bot – Bot the handler belongs to
- message – Message from provider
- service (string) – Identity integration
- state_context (dict) – Previous contexts
- pattern_context (dict) – Dict variables obtained from handler pattern regular expression.
Returns: Text and keyboard response, new state for the chat and context used.
-
Handler.
request
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Handler.
response
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Handler.
source_states
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Handler.
target_state
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
class
permabots.models.handler.
HeaderParam
(*args, **kwargs)[source]¶ Bases:
permabots.models.handler.AbstractParam
Header Parameter associated to the request
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- key (CharField) – Name of the parameter
- value_template (CharField) – Value template of the parameter. In jinja2 format. http://jinja.pocoo.org/
- request_id (ForeignKey) – Request which this Url Parameter is attached to
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
HeaderParam.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
HeaderParam.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
HeaderParam.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
HeaderParam.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
HeaderParam.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
HeaderParam.
objects
= <django.db.models.manager.Manager object>¶
-
HeaderParam.
request
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
class
permabots.models.handler.
Request
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
HTTP Request to perform some processing when handling a message
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- url_template (CharField) – Url to request. A jinja2 template. http://jinja.pocoo.org/
- method (CharField) – Define Http method for the request
- data (TextField) – Set POST/PUT/PATCH data in json format
-
DELETE
= 'Delete'¶
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
Request.
GET
= 'Get'¶
-
Request.
METHOD_CHOICES
= (('Get', <django.utils.functional.__proxy__ object at 0x7fd1f3010310>), ('Post', <django.utils.functional.__proxy__ object at 0x7fd1f3010350>), ('Put', <django.utils.functional.__proxy__ object at 0x7fd1f3010390>), ('Delete', <django.utils.functional.__proxy__ object at 0x7fd1f30103d0>), ('Patch', <django.utils.functional.__proxy__ object at 0x7fd1f3010410>))¶
-
exception
Request.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Request.
PATCH
= 'Patch'¶
-
Request.
POST
= 'Post'¶
-
Request.
PUT
= 'Put'¶
-
Request.
get_method_display
(*moreargs, **morekwargs)¶
-
Request.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
Request.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
Request.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
Request.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
Request.
handler
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
Request.
header_parameters
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Request.
objects
= <django.db.models.manager.Manager object>¶
-
Request.
process
(**context)[source]¶ Process handler request. Before executing requests render templates with context
Parameters: context – Processing context Returns: Requests response <http://docs.python-requests.org/en/master/api/#requests.Response> _.
-
Request.
url_parameters
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
permabots.models.handler.
UrlParam
(*args, **kwargs)[source]¶ Bases:
permabots.models.handler.AbstractParam
Url Parameter associated to the request.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- key (CharField) – Name of the parameter
- value_template (CharField) – Value template of the parameter. In jinja2 format. http://jinja.pocoo.org/
- request_id (ForeignKey) – Request which this Url Parameter is attached to
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
UrlParam.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
UrlParam.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
UrlParam.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
UrlParam.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
UrlParam.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
UrlParam.
objects
= <django.db.models.manager.Manager object>¶
-
UrlParam.
request
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
permabots.models.hook module¶
-
class
permabots.models.hook.
Hook
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Notification Hook representation.
The webhook url is generated with the key.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- bot_id (ForeignKey) – Bot which Hook is attached
- name (CharField) – Name of the hook
- key (CharField) – Key generated to complete the Hook url. http://permabots.com/process/hook/{{key}}
- response_id (OneToOneField) – Template the hook uses to generate the response
- enabled (BooleanField) – Enable/disable hook
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Hook.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Hook.
bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Hook.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
Hook.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
Hook.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
Hook.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
Hook.
kik_recipients
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Hook.
messenger_recipients
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Hook.
objects
= <django.db.models.manager.Manager object>¶
-
Hook.
process
(bot, data)[source]¶ Notification hook processing generating a response.
Parameters: - bot – Bot receiving the hook
- data – JSON data from hook POST
Type: JSON
-
Hook.
response
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Hook.
telegram_recipients
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
permabots.models.hook.
KikRecipient
(id, created_at, updated_at, chat_id, username, name, hook)[source]¶ Bases:
permabots.models.base.PermabotsModel
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- chat_id (CharField) – Chat identifier provided by Kik API
- username (CharField) – User name
- name (CharField) – Name of recipient
- hook_id (ForeignKey) – Hook which recipient is attached to
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
KikRecipient.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
KikRecipient.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
KikRecipient.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
KikRecipient.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
KikRecipient.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
KikRecipient.
hook
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
KikRecipient.
objects
= <django.db.models.manager.Manager object>¶
-
class
permabots.models.hook.
MessengerRecipient
(id, created_at, updated_at, chat_id, name, hook)[source]¶ Bases:
permabots.models.base.PermabotsModel
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- chat_id (CharField) – Chat identifier provided by Messenger API
- name (CharField) – Name of recipient
- hook_id (ForeignKey) – Hook which recipient is attached to
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MessengerRecipient.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
MessengerRecipient.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
MessengerRecipient.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
MessengerRecipient.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
MessengerRecipient.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
MessengerRecipient.
hook
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
MessengerRecipient.
objects
= <django.db.models.manager.Manager object>¶
-
class
permabots.models.hook.
TelegramRecipient
(id, created_at, updated_at, chat_id, name, hook)[source]¶ Bases:
permabots.models.base.PermabotsModel
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- chat_id (BigIntegerField) – Chat identifier provided by Telegram API
- name (CharField) – Name of recipient
- hook_id (ForeignKey) – Hook which recipient is attached to
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
TelegramRecipient.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
TelegramRecipient.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
TelegramRecipient.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
TelegramRecipient.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
TelegramRecipient.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
TelegramRecipient.
hook
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
TelegramRecipient.
objects
= <django.db.models.manager.Manager object>¶
permabots.models.kik_api module¶
-
class
permabots.models.kik_api.
KikChat
(id)[source]¶ Bases:
django.db.models.base.Model
Parameters: id (CharField) – Id -
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
KikChat.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
KikChat.
kik_chatstates
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
KikChat.
messages
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
KikChat.
objects
= <django.db.models.manager.Manager object>¶
-
KikChat.
participants
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
exception
-
class
permabots.models.kik_api.
KikMessage
(id, created_at, updated_at, message_id, from_user, timestamp, chat, body)[source]¶ Bases:
permabots.models.base.PermabotsModel
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- message_id (UUIDField) – Id
- from_user_id (ForeignKey) – User
- timestamp (DateTimeField) – Timestamp
- chat_id (ForeignKey) – Chat
- body (TextField) – Body
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
KikMessage.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
KikMessage.
chat
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
KikMessage.
from_user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
KikMessage.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
KikMessage.
get_next_by_timestamp
(*moreargs, **morekwargs)¶
-
KikMessage.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
KikMessage.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
KikMessage.
get_previous_by_timestamp
(*moreargs, **morekwargs)¶
-
KikMessage.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
KikMessage.
objects
= <django.db.models.manager.Manager object>¶
-
class
permabots.models.kik_api.
KikUser
(username, first_name, last_name)[source]¶ Bases:
django.db.models.base.Model
Parameters: - username (CharField) – User name
- first_name (CharField) – First name
- last_name (CharField) – Last name
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
KikUser.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
KikUser.
chats
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
KikUser.
kik_chatstates
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
KikUser.
messages
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
KikUser.
objects
= <django.db.models.manager.Manager object>¶
permabots.models.messenger_api module¶
-
class
permabots.models.messenger_api.
MessengerMessage
(id, created_at, updated_at, bot, sender, recipient, timestamp, type, postback, text)[source]¶ Bases:
permabots.models.base.PermabotsModel
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- bot_id (ForeignKey) – Messenger bot
- sender (CharField) – Sender id
- recipient (CharField) – Recipient id
- timestamp (DateTimeField) – Timestamp
- type (CharField) – Type
- postback (CharField) – Postback
- text (TextField) – Text
-
DELIVERY
= 'delivery'¶
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
MessengerMessage.
MESSAGE
= 'message'¶
-
exception
MessengerMessage.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
MessengerMessage.
POSTBACK
= 'postback'¶
-
MessengerMessage.
TYPE_CHOICES
= (('message', <django.utils.functional.__proxy__ object at 0x7fd1f3249650>), ('postback', <django.utils.functional.__proxy__ object at 0x7fd1f3249690>), ('delivery', <django.utils.functional.__proxy__ object at 0x7fd1f32496d0>))¶
-
MessengerMessage.
bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
MessengerMessage.
data
¶
-
MessengerMessage.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
MessengerMessage.
get_next_by_timestamp
(*moreargs, **morekwargs)¶
-
MessengerMessage.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
MessengerMessage.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
MessengerMessage.
get_previous_by_timestamp
(*moreargs, **morekwargs)¶
-
MessengerMessage.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
MessengerMessage.
get_type_display
(*moreargs, **morekwargs)¶
-
MessengerMessage.
is_delivery
¶
-
MessengerMessage.
is_message
¶
-
MessengerMessage.
is_postback
¶
-
MessengerMessage.
objects
= <django.db.models.manager.Manager object>¶
permabots.models.response module¶
-
class
permabots.models.response.
Response
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Model to generate a response to send in a message.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- text_template (TextField) – Template to generate text response. In jinja2 format. http://jinja.pocoo.org/
- keyboard_template (TextField) – Template to generate keyboard response. In jinja2 format. http://jinja.pocoo.org/
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Response.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Response.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
Response.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
Response.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
Response.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
Response.
handler
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
Response.
hook
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
Response.
objects
= <django.db.models.manager.Manager object>¶
permabots.models.state module¶
-
class
permabots.models.state.
AbsChatState
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Abstract Model representing the state of a chat. Context used in previous states is associated.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- context (TextField) – Context serialized to json when this state was set
- state_id (ForeignKey) – State related to the chat
-
AbsChatState.
ctx
¶
-
AbsChatState.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
AbsChatState.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
AbsChatState.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
AbsChatState.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
AbsChatState.
state
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
class
permabots.models.state.
KikChatState
(id, created_at, updated_at, context, state, chat, user)[source]¶ Bases:
permabots.models.state.AbsChatState
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- context (TextField) – Context serialized to json when this state was set
- state_id (ForeignKey) – State related to the chat
- chat_id (ForeignKey) – Chat in Kik API format. https://dev.kik.com/#/docs/messaging#authentication
- user_id (ForeignKey) – Kik unique username
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
KikChatState.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
KikChatState.
chat
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
KikChatState.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
KikChatState.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
KikChatState.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
KikChatState.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
KikChatState.
objects
= <django.db.models.manager.Manager object>¶
-
KikChatState.
state
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
KikChatState.
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
class
permabots.models.state.
MessengerChatState
(id, created_at, updated_at, context, state, chat)[source]¶ Bases:
permabots.models.state.AbsChatState
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- context (TextField) – Context serialized to json when this state was set
- state_id (ForeignKey) – State related to the chat
- chat (CharField) – Sender id
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MessengerChatState.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
MessengerChatState.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
MessengerChatState.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
MessengerChatState.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
MessengerChatState.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
MessengerChatState.
objects
= <django.db.models.manager.Manager object>¶
-
MessengerChatState.
state
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
class
permabots.models.state.
State
(*args, **kwargs)[source]¶ Bases:
permabots.models.base.PermabotsModel
Represents a state for a conversation and a bot.
Depending the state of the chat only some actions can be performed.
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- name (CharField) – Name of the state
- bot_id (ForeignKey) – Bot which state is attached to
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
State.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
State.
bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
State.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
State.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
State.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
State.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
State.
kikchatstate_chat
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
State.
messengerchatstate_chat
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
State.
objects
= <django.db.models.manager.Manager object>¶
-
State.
source_handlers
¶ Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
In the example:
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
pizza.toppings
andtopping.pizzas
areManyToManyDescriptor
instances.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
State.
target_handlers
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
State.
telegramchatstate_chat
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
permabots.models.state.
TelegramChatState
(id, created_at, updated_at, context, state, chat, user)[source]¶ Bases:
permabots.models.state.AbsChatState
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- context (TextField) – Context serialized to json when this state was set
- state_id (ForeignKey) – State related to the chat
- chat_id (ForeignKey) – Chat in Telegram API format. https://core.telegram.org/bots/api#chat
- user_id (ForeignKey) – Telegram unique username
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
TelegramChatState.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
TelegramChatState.
chat
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
TelegramChatState.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
TelegramChatState.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
TelegramChatState.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
TelegramChatState.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
TelegramChatState.
objects
= <django.db.models.manager.Manager object>¶
-
TelegramChatState.
state
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
TelegramChatState.
user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
permabots.models.telegram_api module¶
-
class
permabots.models.telegram_api.
CallbackQuery
(id, created_at, updated_at, callback_id, from_user, message, data)[source]¶ Bases:
permabots.models.base.PermabotsModel
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- callback_id (CharField) – Id
- from_user_id (ForeignKey) – User
- message_id (ForeignKey) – Message
- data (TextField) – Data
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
CallbackQuery.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
CallbackQuery.
from_user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
CallbackQuery.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
CallbackQuery.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
CallbackQuery.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
CallbackQuery.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
CallbackQuery.
message
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
CallbackQuery.
objects
= <django.db.models.manager.Manager object>¶
-
CallbackQuery.
updates
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
permabots.models.telegram_api.
Chat
(id, type, title, username, first_name, last_name)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (BigIntegerField) – Id
- type (CharField) – Type
- title (CharField) – Title
- username (CharField) – Username
- first_name (CharField) – First name
- last_name (CharField) – Last name
-
CHANNEL
= 'channel'¶
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
Chat.
GROUP
= 'group'¶
-
exception
Chat.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Chat.
PRIVATE
= 'private'¶
-
Chat.
SUPERGROUP
= 'supergroup'¶
-
Chat.
TYPE_CHOICES
= (('private', <django.utils.functional.__proxy__ object at 0x7fd1f329f110>), ('group', <django.utils.functional.__proxy__ object at 0x7fd1f329f190>), ('supergroup', <django.utils.functional.__proxy__ object at 0x7fd1f329f1d0>), ('channel', <django.utils.functional.__proxy__ object at 0x7fd1f329f210>))¶
-
Chat.
get_type_display
(*moreargs, **morekwargs)¶
-
Chat.
messages
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Chat.
objects
= <django.db.models.manager.Manager object>¶
-
Chat.
telegram_chatstates
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
permabots.models.telegram_api.
Message
(id, created_at, updated_at, message_id, from_user, date, chat, forward_from, text)[source]¶ Bases:
permabots.models.base.PermabotsModel
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- message_id (BigIntegerField) – Id
- from_user_id (ForeignKey) – User
- date (DateTimeField) – Date
- chat_id (ForeignKey) – Chat
- forward_from_id (ForeignKey) – Forward from
- text (TextField) – Text
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Message.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Message.
callback_queries
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
Message.
chat
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Message.
forward_from
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Message.
from_user
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Message.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
Message.
get_next_by_date
(*moreargs, **morekwargs)¶
-
Message.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
Message.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
Message.
get_previous_by_date
(*moreargs, **morekwargs)¶
-
Message.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
Message.
objects
= <django.db.models.manager.Manager object>¶
-
Message.
updates
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
class
permabots.models.telegram_api.
Update
(id, created_at, updated_at, bot, update_id, message, callback_query)[source]¶ Bases:
permabots.models.base.PermabotsModel
Parameters: - id (UUIDField) – Id
- created_at (DateTimeField) – Date created
- updated_at (DateTimeField) – Date updated
- bot_id (ForeignKey) – Bot
- update_id (BigIntegerField) – Update id
- message_id (ForeignKey) – Message
- callback_query_id (ForeignKey) – Callback query
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
Update.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
Update.
bot
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Update.
callback_query
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Update.
get_next_by_created_at
(*moreargs, **morekwargs)¶
-
Update.
get_next_by_updated_at
(*moreargs, **morekwargs)¶
-
Update.
get_previous_by_created_at
(*moreargs, **morekwargs)¶
-
Update.
get_previous_by_updated_at
(*moreargs, **morekwargs)¶
-
Update.
message
¶ Accessor to the related object on the forward side of a many-to-one or one-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
child.parent
is aForwardManyToOneDescriptor
instance.
-
Update.
objects
= <django.db.models.manager.Manager object>¶
-
class
permabots.models.telegram_api.
User
(id, first_name, last_name, username)[source]¶ Bases:
django.db.models.base.Model
Parameters: - id (BigIntegerField) – Id
- first_name (CharField) – First name
- last_name (CharField) – Last name
- username (CharField) – User name
-
exception
DoesNotExist
¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
User.
MultipleObjectsReturned
¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
User.
callback_queries
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
forwarded_from
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
messages
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.
-
User.
objects
= <django.db.models.manager.Manager object>¶
-
User.
telegram_bot
¶ Accessor to the related object on the reverse side of a one-to-one relation.
In the example:
class Restaurant(Model): place = OneToOneField(Place, related_name='restaurant')
place.restaurant
is aReverseOneToOneDescriptor
instance.
-
User.
telegram_chatstates
¶ Accessor to the related objects manager on the reverse side of a many-to-one relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
parent.children
is aReverseManyToOneDescriptor
instance.Most of the implementation is delegated to a dynamically defined manager class built by
create_forward_many_to_many_manager()
defined below.