mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 15:34:31 +00:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -21,10 +21,18 @@ export async function readMessagesDiscord(
|
||||
? Math.min(Math.max(Math.floor(query.limit), 1), 100)
|
||||
: undefined;
|
||||
const params: Record<string, string | number> = {};
|
||||
if (limit) params.limit = limit;
|
||||
if (query.before) params.before = query.before;
|
||||
if (query.after) params.after = query.after;
|
||||
if (query.around) params.around = query.around;
|
||||
if (limit) {
|
||||
params.limit = limit;
|
||||
}
|
||||
if (query.before) {
|
||||
params.before = query.before;
|
||||
}
|
||||
if (query.after) {
|
||||
params.after = query.after;
|
||||
}
|
||||
if (query.around) {
|
||||
params.around = query.around;
|
||||
}
|
||||
return (await rest.get(Routes.channelMessages(channelId), params)) as APIMessage[];
|
||||
}
|
||||
|
||||
@@ -108,8 +116,12 @@ export async function listThreadsDiscord(payload: DiscordThreadList, opts: Disco
|
||||
throw new Error("channelId required to list archived threads");
|
||||
}
|
||||
const params: Record<string, string | number> = {};
|
||||
if (payload.before) params.before = payload.before;
|
||||
if (payload.limit) params.limit = payload.limit;
|
||||
if (payload.before) {
|
||||
params.before = payload.before;
|
||||
}
|
||||
if (payload.limit) {
|
||||
params.limit = payload.limit;
|
||||
}
|
||||
return await rest.get(Routes.channelThreads(payload.channelId, "public"), params);
|
||||
}
|
||||
return await rest.get(Routes.guildActiveThreads(payload.guildId));
|
||||
|
||||
Reference in New Issue
Block a user