Skip to content

Commit

Permalink
Use here detection
Browse files Browse the repository at this point in the history
  • Loading branch information
danielcardeenas committed Apr 4, 2020
1 parent bf7e60b commit 76683b6
Show file tree
Hide file tree
Showing 47 changed files with 1,919 additions and 2,084 deletions.
Binary file added arnold.mp4
Binary file not shown.
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
},
"homepage": "https://github.com/danielcardeenas/sulla#readme",
"devDependencies": {
"@types/node": "^13.9.8",
"@types/node": "^13.11.0",
"@types/puppeteer": "^2.0.1",
"@types/sharp": "^0.24.0",
"concurrently": "^5.1.0",
Expand All @@ -55,12 +55,11 @@
"webpack-cli": "^3.3.11"
},
"dependencies": {
"axios": "^0.19.2",
"file-type": "^14.1.4",
"ora": "^4.0.3",
"puppeteer": "^2.1.1",
"qrcode-terminal": "^0.12.0",
"rxjs": "^6.5.4",
"rxjs": "^6.5.5",
"sharp": "^0.25.2"
}
}
12 changes: 0 additions & 12 deletions src/api/functions/get-connection-state.ts

This file was deleted.

10 changes: 0 additions & 10 deletions src/api/functions/index.ts

This file was deleted.

24 changes: 0 additions & 24 deletions src/api/functions/reply.ts

This file was deleted.

53 changes: 0 additions & 53 deletions src/api/functions/send-file.ts

This file was deleted.

32 changes: 0 additions & 32 deletions src/api/functions/send-image.ts

This file was deleted.

38 changes: 0 additions & 38 deletions src/api/functions/send-message-with-thumb.ts

This file was deleted.

25 changes: 0 additions & 25 deletions src/api/functions/send-text-with-tags.ts

This file was deleted.

19 changes: 0 additions & 19 deletions src/api/functions/send-text.ts

This file was deleted.

20 changes: 0 additions & 20 deletions src/api/functions/set-chat-state.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/api/functions/set-profile-name.ts

This file was deleted.

16 changes: 0 additions & 16 deletions src/api/functions/set-profile-status.ts

This file was deleted.

14 changes: 14 additions & 0 deletions src/api/layers/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Layers

#### Each layer should extends the previous one in the next order:

1. Host layer
2. Profile layer
3. Listener layer
4. Sender layer
5. Retriever layer
6. Group layer
7. Controls layer
8. Business layer (Optional)

**Controls layer** should be enough
55 changes: 55 additions & 0 deletions src/api/layers/business.layer.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { Page } from 'puppeteer';
import { ControlsLayer } from './controls.layer';

declare module WAPI {
const getBusinessProfilesProducts: (to: string) => any;
const sendImageWithProduct: (
base64: string,
to: string,
caption: string,
bizNumber: string,
productId: string
) => any;
}

export class BusinessLayer extends ControlsLayer {
constructor(page: Page) {
super(page);
}

/**
* Querys product catalog
* @param id Buisness profile id ('[email protected]')
*/
public async getBusinessProfilesProducts(id: string) {
return this.page.evaluate(
({ id }) => {
WAPI.getBusinessProfilesProducts(id);
},
{ id }
);
}

/**
* Sends product with product image to given chat id
* @param to Chat id
* @param base64 Base64 image data
* @param caption Message body
* @param businessId Business id number that owns the product ('[email protected]')
* @param productId Product id, see method getBusinessProfilesProducts for more info
*/
public async sendImageWithProduct(
to: string,
base64: string,
caption: string,
businessId: string,
productId: string
) {
return this.page.evaluate(
({ to, base64, businessId, caption, productId }) => {
WAPI.sendImageWithProduct(base64, to, caption, businessId, productId);
},
{ to, base64, businessId, caption, productId }
);
}
}
Loading

0 comments on commit 76683b6

Please sign in to comment.