mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 02:52:43 +00:00
chore: Lint extensions folder.
This commit is contained in:
@@ -18,8 +18,12 @@ function resolveAccount(params: BlueBubblesChatOpts) {
|
||||
});
|
||||
const baseUrl = params.serverUrl?.trim() || account.config.serverUrl?.trim();
|
||||
const password = params.password?.trim() || account.config.password?.trim();
|
||||
if (!baseUrl) throw new Error("BlueBubbles serverUrl is required");
|
||||
if (!password) throw new Error("BlueBubbles password is required");
|
||||
if (!baseUrl) {
|
||||
throw new Error("BlueBubbles serverUrl is required");
|
||||
}
|
||||
if (!password) {
|
||||
throw new Error("BlueBubbles password is required");
|
||||
}
|
||||
return { baseUrl, password };
|
||||
}
|
||||
|
||||
@@ -28,7 +32,9 @@ export async function markBlueBubblesChatRead(
|
||||
opts: BlueBubblesChatOpts = {},
|
||||
): Promise<void> {
|
||||
const trimmed = chatGuid.trim();
|
||||
if (!trimmed) return;
|
||||
if (!trimmed) {
|
||||
return;
|
||||
}
|
||||
const { baseUrl, password } = resolveAccount(opts);
|
||||
const url = buildBlueBubblesApiUrl({
|
||||
baseUrl,
|
||||
@@ -48,7 +54,9 @@ export async function sendBlueBubblesTyping(
|
||||
opts: BlueBubblesChatOpts = {},
|
||||
): Promise<void> {
|
||||
const trimmed = chatGuid.trim();
|
||||
if (!trimmed) return;
|
||||
if (!trimmed) {
|
||||
return;
|
||||
}
|
||||
const { baseUrl, password } = resolveAccount(opts);
|
||||
const url = buildBlueBubblesApiUrl({
|
||||
baseUrl,
|
||||
@@ -76,9 +84,13 @@ export async function editBlueBubblesMessage(
|
||||
opts: BlueBubblesChatOpts & { partIndex?: number; backwardsCompatMessage?: string } = {},
|
||||
): Promise<void> {
|
||||
const trimmedGuid = messageGuid.trim();
|
||||
if (!trimmedGuid) throw new Error("BlueBubbles edit requires messageGuid");
|
||||
if (!trimmedGuid) {
|
||||
throw new Error("BlueBubbles edit requires messageGuid");
|
||||
}
|
||||
const trimmedText = newText.trim();
|
||||
if (!trimmedText) throw new Error("BlueBubbles edit requires newText");
|
||||
if (!trimmedText) {
|
||||
throw new Error("BlueBubbles edit requires newText");
|
||||
}
|
||||
|
||||
const { baseUrl, password } = resolveAccount(opts);
|
||||
const url = buildBlueBubblesApiUrl({
|
||||
@@ -118,7 +130,9 @@ export async function unsendBlueBubblesMessage(
|
||||
opts: BlueBubblesChatOpts & { partIndex?: number } = {},
|
||||
): Promise<void> {
|
||||
const trimmedGuid = messageGuid.trim();
|
||||
if (!trimmedGuid) throw new Error("BlueBubbles unsend requires messageGuid");
|
||||
if (!trimmedGuid) {
|
||||
throw new Error("BlueBubbles unsend requires messageGuid");
|
||||
}
|
||||
|
||||
const { baseUrl, password } = resolveAccount(opts);
|
||||
const url = buildBlueBubblesApiUrl({
|
||||
@@ -156,7 +170,9 @@ export async function renameBlueBubblesChat(
|
||||
opts: BlueBubblesChatOpts = {},
|
||||
): Promise<void> {
|
||||
const trimmedGuid = chatGuid.trim();
|
||||
if (!trimmedGuid) throw new Error("BlueBubbles rename requires chatGuid");
|
||||
if (!trimmedGuid) {
|
||||
throw new Error("BlueBubbles rename requires chatGuid");
|
||||
}
|
||||
|
||||
const { baseUrl, password } = resolveAccount(opts);
|
||||
const url = buildBlueBubblesApiUrl({
|
||||
@@ -190,9 +206,13 @@ export async function addBlueBubblesParticipant(
|
||||
opts: BlueBubblesChatOpts = {},
|
||||
): Promise<void> {
|
||||
const trimmedGuid = chatGuid.trim();
|
||||
if (!trimmedGuid) throw new Error("BlueBubbles addParticipant requires chatGuid");
|
||||
if (!trimmedGuid) {
|
||||
throw new Error("BlueBubbles addParticipant requires chatGuid");
|
||||
}
|
||||
const trimmedAddress = address.trim();
|
||||
if (!trimmedAddress) throw new Error("BlueBubbles addParticipant requires address");
|
||||
if (!trimmedAddress) {
|
||||
throw new Error("BlueBubbles addParticipant requires address");
|
||||
}
|
||||
|
||||
const { baseUrl, password } = resolveAccount(opts);
|
||||
const url = buildBlueBubblesApiUrl({
|
||||
@@ -226,9 +246,13 @@ export async function removeBlueBubblesParticipant(
|
||||
opts: BlueBubblesChatOpts = {},
|
||||
): Promise<void> {
|
||||
const trimmedGuid = chatGuid.trim();
|
||||
if (!trimmedGuid) throw new Error("BlueBubbles removeParticipant requires chatGuid");
|
||||
if (!trimmedGuid) {
|
||||
throw new Error("BlueBubbles removeParticipant requires chatGuid");
|
||||
}
|
||||
const trimmedAddress = address.trim();
|
||||
if (!trimmedAddress) throw new Error("BlueBubbles removeParticipant requires address");
|
||||
if (!trimmedAddress) {
|
||||
throw new Error("BlueBubbles removeParticipant requires address");
|
||||
}
|
||||
|
||||
const { baseUrl, password } = resolveAccount(opts);
|
||||
const url = buildBlueBubblesApiUrl({
|
||||
@@ -263,7 +287,9 @@ export async function leaveBlueBubblesChat(
|
||||
opts: BlueBubblesChatOpts = {},
|
||||
): Promise<void> {
|
||||
const trimmedGuid = chatGuid.trim();
|
||||
if (!trimmedGuid) throw new Error("BlueBubbles leaveChat requires chatGuid");
|
||||
if (!trimmedGuid) {
|
||||
throw new Error("BlueBubbles leaveChat requires chatGuid");
|
||||
}
|
||||
|
||||
const { baseUrl, password } = resolveAccount(opts);
|
||||
const url = buildBlueBubblesApiUrl({
|
||||
@@ -291,7 +317,9 @@ export async function setGroupIconBlueBubbles(
|
||||
opts: BlueBubblesChatOpts & { contentType?: string } = {},
|
||||
): Promise<void> {
|
||||
const trimmedGuid = chatGuid.trim();
|
||||
if (!trimmedGuid) throw new Error("BlueBubbles setGroupIcon requires chatGuid");
|
||||
if (!trimmedGuid) {
|
||||
throw new Error("BlueBubbles setGroupIcon requires chatGuid");
|
||||
}
|
||||
if (!buffer || buffer.length === 0) {
|
||||
throw new Error("BlueBubbles setGroupIcon requires image buffer");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user