コード例 #1
0
    def on_message(self, message_entity):
        print(" ->>>>>> MESSAGE RECEIVED!!!!!!")
        # Set received (double v) and add to ack queue
        mac.receive_message(self, message_entity)

        if message_entity.getType() == 'text':
            self.onTextMessage(message_entity)
        elif message_entity.getType() == 'media':
            # self.onMediaMessage(message_entity)
            mac.disconnect(self)
コード例 #2
0
 def on_message(self, message_entity):
     mac.receive_message(self, message_entity)
     
     message = Message(message_entity)
     if message.valid:
         signals.message_received.send(message)
         if helper.is_command(message.message):
             signals.command_received.send(message)
         
     mac.disconnect(self)
コード例 #3
0
    def on_message(self, message_entity):
        # Set received (double v) and add to ack queue
        mac.receive_message(self, message_entity)

        # Make message
        message = Message(message_entity)
        if message.valid:
            signals.message_received.send(message)
            if helper.is_command(message.message):
                signals.command_received.send(message)

        mac.disconnect(self)
コード例 #4
0
    def on_message(self, message_entity):
        if helper.is_text_message(message_entity):
            mac.set_entity(self)

            # Set received (double v) and add to ack queue
            mac.receive_message(self, message_entity)

            # Send signal
            self.send_message_signal(message_entity)

            # Finally set offline
            mac.disconnect(self)
コード例 #5
0
ファイル: layer.py プロジェクト: gvaldez81/whatsapp-framework
    def on_message(self, message_entity):
        if helper.is_text_message(message_entity):
            mac.set_entity(self)

            # Set received (double v) and add to ack queue
            mac.receive_message(self, message_entity)

            # Handle intercepts if needed}
            # Not needed anymore
            #receiver.intercept(self, message_entity)

            # Send signal
            self.send_message_signal(message_entity)

            # Finally set offline
            mac.disconnect(self)
コード例 #6
0
ファイル: layer.py プロジェクト: ediited/MacBot
    def on_message(self, message_entity):
        if helper.is_text_message(message_entity):

            # Set received (double v) and add to ack queue
            mac.receive_message(self, message_entity)

            # Handle intercepts if needed
            receiver.intercept(self, message_entity)

            # If is a mac order. (Message starts with '!')
            if mac.should_write(message_entity):
                # Prepare mac to answer (Human behavior)
                mac.prepate_answer(self, message_entity)

                # Send the answer, here magic happens
                self.on_text_message(message_entity)
                time.sleep(random.uniform(0.5, 1.5))

            # Finally Set offline
            mac.disconnect(self)