mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-15 19:08:17 +00:00
fix: remove get query loop loop de loop loop
This commit is contained in:
@@ -4,15 +4,21 @@ import { AuditLogEvents } from "../../types/shared.ts";
|
||||
|
||||
/** Returns the audit logs for the guild. Requires VIEW AUDIT LOGS permission */
|
||||
export async function getAuditLogs(bot: Bot, guildId: bigint, options?: GetGuildAuditLog) {
|
||||
if (options?.userId) options.userId = options.userId.toString();
|
||||
if (options?.before) options.before = options.before.toString();
|
||||
if (options?.limit) options.limit = options.limit >= 1 && options.limit <= 100 ? options.limit : 50;
|
||||
|
||||
let url = bot.constants.endpoints.GUILD_AUDIT_LOGS(guildId);
|
||||
if (options) {
|
||||
url += "?";
|
||||
|
||||
if (options.actionType) url += `action_type=${options.actionType}`;
|
||||
if (options.before) url += `&before=${options.before}`;
|
||||
if (options.limit) url += `&limit=${options.limit}`;
|
||||
if (options.userId) url += `&user_id=${options.userId}`;
|
||||
}
|
||||
const auditlog = await bot.rest.runMethod<DiscordAuditLog>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.GUILD_AUDIT_LOGS(guildId),
|
||||
options,
|
||||
url,
|
||||
);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user