chore: cleanup, ci workflows and formatting (#127064)

* ci: setup workflows, dependabot, labeler and commit linting

* docs: update README, community files and issue templates

* chore: configure prettier, editorconfig and format codebase

* chore: restore changes lost during rebase

* docs: adjust url for new logo

* fix: align badges

* chore: resolve conflicts and re-add temp lint
This commit is contained in:
2^1 2026-03-10 00:45:12 +01:00 • committed by GitHub
commit 807efd502d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -85,15 +85,17 @@ class Chat extends Base {
* Last message fo chat
* @type {Message}
*/
this.lastMessage = data.lastMessage ? new Message(this.client, data.lastMessage) : undefined;
this.lastMessage = data.lastMessage
? new Message(this.client, data.lastMessage)
: undefined;
return super._patch(data);
}
/**
* Send a message to this chat
* @param {string|MessageMedia|Location} content
* @param {MessageSendOptions} [options]
* @param {MessageSendOptions} [options]
* @returns {Promise<Message>} Message that was just sent
*/
async sendMessage(content, options) {
@ -113,7 +115,7 @@ class Chat extends Base {
* @returns {Promise<boolean>} result
*/
async clearMessages() {
return this.client.pupPage.evaluate(chatId => {
return this.client.pupPage.evaluate((chatId) => {
return window.WWebJS.sendClearChat(chatId);
}, this.id._serialized);
}
@ -123,7 +125,7 @@ class Chat extends Base {
* @returns {Promise<Boolean>} result
*/
async delete() {
return this.client.pupPage.evaluate(chatId => {
return this.client.pupPage.evaluate((chatId) => {
return window.WWebJS.sendDeleteChat(chatId);
}, this.id._serialized);
}
@ -164,7 +166,10 @@ class Chat extends Base {
* @returns {Promise<{isMuted: boolean, muteExpiration: number}>}
*/
async mute(unmuteDate) {
const result = await this.client.muteChat(this.id._serialized, unmuteDate);
const result = await this.client.muteChat(
this.id._serialized,
unmuteDate,
);
this.isMuted = result.isMuted;
this.muteExpiration = result.muteExpiration;
return result;
@ -184,7 +189,7 @@ class Chat extends Base {
/**
* Mark this chat as unread
*/
async markUnread(){
async markUnread() {
return this.client.markChatUnread(this.id._serialized);
}
@ -196,45 +201,56 @@ class Chat extends Base {
* @returns {Promise<Array<Message>>}
*/
async fetchMessages(searchOptions) {
let messages = await this.client.pupPage.evaluate(async (chatId, searchOptions) => {
const msgFilter = (m) => {
if (m.isNotification) {
return false; // dont include notification messages
let messages = await this.client.pupPage.evaluate(
async (chatId, searchOptions) => {
const msgFilter = (m) => {
if (m.isNotification) {
return false; // dont include notification messages
}
if (
searchOptions &&
searchOptions.fromMe !== undefined &&
m.id.fromMe !== searchOptions.fromMe
) {
return false;
}
return true;
};
const chat = await window.WWebJS.getChat(chatId, {
getAsModel: false,
});
let msgs = chat.msgs.getModelsArray().filter(msgFilter);
if (searchOptions && searchOptions.limit > 0) {
while (msgs.length < searchOptions.limit) {
const loadedMessages = await window
.require('WAWebChatLoadMessages')
.loadEarlierMsgs(chat, chat.msgs);
if (!loadedMessages || !loadedMessages.length) break;
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
}
if (msgs.length > searchOptions.limit) {
msgs.sort((a, b) => (a.t > b.t ? 1 : -1));
msgs = msgs.splice(msgs.length - searchOptions.limit);
}
}
if (searchOptions && searchOptions.fromMe !== undefined && m.id.fromMe !== searchOptions.fromMe) {
return false;
}
return true;
};
const chat = await window.WWebJS.getChat(chatId, { getAsModel: false });
let msgs = chat.msgs.getModelsArray().filter(msgFilter);
return msgs.map((m) => window.WWebJS.getMessageModel(m));
},
this.id._serialized,
searchOptions,
);
if (searchOptions && searchOptions.limit > 0) {
while (msgs.length < searchOptions.limit) {
const loadedMessages = await (window.require('WAWebChatLoadMessages')).loadEarlierMsgs(chat,chat.msgs);
if (!loadedMessages || !loadedMessages.length) break;
msgs = [...loadedMessages.filter(msgFilter), ...msgs];
}
if (msgs.length > searchOptions.limit) {
msgs.sort((a, b) => (a.t > b.t) ? 1 : -1);
msgs = msgs.splice(msgs.length - searchOptions.limit);
}
}
return msgs.map(m => window.WWebJS.getMessageModel(m));
}, this.id._serialized, searchOptions);
return messages.map(m => new Message(this.client, m));
return messages.map((m) => new Message(this.client, m));
}
/**
* Simulate typing in chat. This will last for 25 seconds.
*/
async sendStateTyping() {
return this.client.pupPage.evaluate(chatId => {
return this.client.pupPage.evaluate((chatId) => {
window.WWebJS.sendChatstate('typing', chatId);
return true;
}, this.id._serialized);
@ -244,7 +260,7 @@ class Chat extends Base {
* Simulate recording audio in chat. This will last for 25 seconds.
*/
async sendStateRecording() {
return this.client.pupPage.evaluate(chatId => {
return this.client.pupPage.evaluate((chatId) => {
window.WWebJS.sendChatstate('recording', chatId);
return true;
}, this.id._serialized);
@ -254,7 +270,7 @@ class Chat extends Base {
* Stops typing or recording in chat immediately.
*/
async clearState() {
return this.client.pupPage.evaluate(chatId => {
return this.client.pupPage.evaluate((chatId) => {
window.WWebJS.sendChatstate('stop', chatId);
return true;
}, this.id._serialized);
@ -292,7 +308,7 @@ class Chat extends Base {
async getPinnedMessages() {
return this.client.getPinnedMessages(this.id._serialized);
}
/**
* Sync chat history conversation
* @return {Promise<boolean>} True if operation completed successfully, false otherwise.
@ -327,7 +343,7 @@ class Chat extends Base {
*/
async getCustomerNote() {
if (this.isGroup || this.isChannel) return null;
return this.client.getCustomerNote(this.id._serialized);
}
}