示例#1
0
    def __init__(self, parameters=None, client: Client = None):
        self.database: dict = self.get(parameters, 'database')
        self.author_id: int = self.get(parameters, 'author_id')
        self.message_object: fbchat.Message = self.get(parameters,
                                                       'message_object')
        self.thread_id: int = self.get(parameters, 'thread_id')
        self.thread_type: fbchat.ThreadType = self.get(parameters,
                                                       'thread_type')
        self.trigger = self.get(parameters, 'trigger')
        self.documentation = {"parameters": "", "function": ""}

        self.client: fbchat.Client = client
        if client:
            self.author: fbchat.User = self.client.fetchUserInfo(
                self.author_id)[self.author_id]
            self.gdb = self.get(parameters, 'gdb')
            client.markAsDelivered(self.thread_id, self.message_object.uid)
            client.markAsRead(self.thread_id)
        if parameters:
            if 'memory' not in self.database:
                self.database['memory']: dict = {}
            self.memory = self.database['memory']
            if str(self.author_id) not in self.memory:
                self.memory[str(self.author_id)]: dict = {}
            self.memory = self.memory[str(self.author_id)]
        self.define_documentation()
示例#2
0
    def __init__(self, parameters, client:Client):
        self.user_params = parameters['user']
        self.author_id = parameters['author_id']
        self.message_object = parameters['message_object']
        self.thread_id = parameters['thread_id']
        self.thread_type = parameters['thread_type']
        self.client = client
        self.author = self.client.fetchUserInfo(self.author_id)[self.author_id]

        client.markAsDelivered(self.thread_id, self.message_object.uid)
        client.markAsRead(self.thread_id)

        self.run()