mirror of
https://github.com/cheveguerra/whatsapp-web.js.git
synced 2026-04-19 20:19:14 +00:00
Basic changes; no real change
This commit is contained in:
@@ -195,9 +195,8 @@ client.on('message', async msg => {
|
|||||||
client.interface.openChatWindowAt(quotedMsg.id._serialized);
|
client.interface.openChatWindowAt(quotedMsg.id._serialized);
|
||||||
}
|
}
|
||||||
} else if (msg.body === '!buttons') {
|
} else if (msg.body === '!buttons') {
|
||||||
// Limited to 5 buttons per message and limited to 3 buttons for each kind, in this case the third quick reply button will be removed
|
|
||||||
let button = new Buttons(
|
let button = new Buttons(
|
||||||
'Button body',
|
'Button body\n\nWant to test buttons some more? Check out https://github.com/wwebjs/buttons-test',
|
||||||
[
|
[
|
||||||
{ body: 'Some text' },
|
{ body: 'Some text' },
|
||||||
{ body: 'Try clicking me (id:test)', id: 'test'},
|
{ body: 'Try clicking me (id:test)', id: 'test'},
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ const MessageMedia = require('./MessageMedia');
|
|||||||
* @typedef {Object} ButtonSpec
|
* @typedef {Object} ButtonSpec
|
||||||
* @property {string} body - The text to show on the button.
|
* @property {string} body - The text to show on the button.
|
||||||
* @property {string=} id - Custom ID to set on the button. A random one will be generated if one is not passed.
|
* @property {string=} id - Custom ID to set on the button. A random one will be generated if one is not passed.
|
||||||
* @ property {string=} url - Custom URL to set on the button. Optional and will change the type of the button
|
* @property {string=} url - Custom URL to set on the button. Optional and will change the type of the button
|
||||||
* @ property {string=} number - Custom URL to set on the button. Optional and will change the type of the button
|
* @property {string=} number - Custom URL to set on the button. Optional and will change the type of the button
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -79,22 +79,22 @@ class Buttons {
|
|||||||
if (button.url && button.number && button.id) throw 'Only pick one of the following (url/number/id)';
|
if (button.url && button.number && button.id) throw 'Only pick one of the following (url/number/id)';
|
||||||
if (button.number) {
|
if (button.number) {
|
||||||
throw 'Not supported, URL and Call buttons are not supported on IOS';
|
throw 'Not supported, URL and Call buttons are not supported on IOS';
|
||||||
/* return {
|
return {
|
||||||
index,
|
index,
|
||||||
callButton: {
|
callButton: {
|
||||||
displayText: button.body,
|
displayText: button.body,
|
||||||
phoneNumber: button.number || ''
|
phoneNumber: button.number || ''
|
||||||
}
|
}
|
||||||
}; */
|
};
|
||||||
} else if (button.url) {
|
} else if (button.url) {
|
||||||
throw 'Not supported, URL and Call buttons are not supported on IOS';
|
throw 'Not supported, URL and Call buttons are not supported on IOS';
|
||||||
/* return {
|
return {
|
||||||
index,
|
index,
|
||||||
urlButton: {
|
urlButton: {
|
||||||
displayText: button.body,
|
displayText: button.body,
|
||||||
url: button.url || ''
|
url: button.url || ''
|
||||||
}
|
}
|
||||||
}; */
|
};
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
index,
|
index,
|
||||||
|
|||||||
@@ -105,12 +105,13 @@ exports.ExposeStore = (moduleRaidStr) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Function to modify functions.
|
// Function to modify functions.
|
||||||
|
// This function simply just runs the callback you provide with the original code in the first argument and all the arguments passed to that function.
|
||||||
window.injectToFunction = (selector, callback) => {
|
window.injectToFunction = (selector, callback) => {
|
||||||
const oldFunct = window.mR.findModule(selector.name)[selector.index][selector.property];
|
const oldFunct = window.mR.findModule(selector.name)[selector.index][selector.property];
|
||||||
window.mR.findModule(selector.name)[selector.index][selector.property] = (...args) => callback(oldFunct, args);
|
window.mR.findModule(selector.name)[selector.index][selector.property] = (...args) => callback(oldFunct, args);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Find button models
|
// Find Template models
|
||||||
window.Store.TemplateButtonModel = window.findProxyModel('TemplateButtonModel');
|
window.Store.TemplateButtonModel = window.findProxyModel('TemplateButtonModel');
|
||||||
window.Store.TemplateButtonCollection = window.mR.findModule('TemplateButtonCollection')[0].TemplateButtonCollection;
|
window.Store.TemplateButtonCollection = window.mR.findModule('TemplateButtonCollection')[0].TemplateButtonCollection;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user