-
Notifications
You must be signed in to change notification settings - Fork 7
action.py
All commands and keywords must inherit Action
.
Inheriting `Action' you these variables:
ID of the person who sent this action.
The action's message object.
Type: fbchat.Message
ID of the chat this action was sent in.
Type of the chat this action was sent in.
Type: fbchat.ThreadType(enum)
The Dentaku user account.
Type: fbchat.Client
The object of the person who sent this action.
Type: fbchat.User
A dictionary that exists independently of each Action. It is mutable, which means you can change self.database within your Action and that change would be seen in every Action run after that.
Type: dict
A dictionary that's specific to each user and Action. Allows you to make long term interactions. Example: rps.py
in the commands
module.
Type: dict
An object representing the VikingsDev Cloud Firestore.
Type: google.cloud.firestore_v1.client.Client
Guide on how to use Cloud Firestore
The equivalent of db.collection(u'users')
is self.gdb.collection(u'users')
The documentation object. Contains the properties "parameters"
and "function"
. The parameters are to specify what the user should input after calling the action. The function is to describe what the action does.
Example:
countdown.py
self.documentation = {
"parameters": "NUMBER",
"function": "To countdown recursively, starting from NUMBER."
}
Implement self.documentation in your action by adding the function define_documentation(self)
within the class of your action.
def define_documentation(self):
self.documentation = {
"parameters": "NUMBER",
"function": "Counts down recursively from NUMBER."
}
You must run the function define_documentation before retrieving the documentation object or else it will be empty.
Important: When you define the parameters of your command, please make them capitalized. If you have no parameters, simply use "None" as your parameter. When defining "function", be as concise as possible and reference all possible parameters.
(If you are confused, take a peek at the other commands to see self.documentation conventions!)