docs(rest,types): Update AuditLog related comments (#2225)

* deno fmt

* Update audit log interfaces

Closes: #2214
Upstream: 618691228a

Update GetAuditLogs interface
Update AuditLogEvents enum
Update DiscordAuditLog and DiscordAuditLogEntry interfaces JSDOcs
Update DiscordAuditLogChange interface (https://discord.com/developers/docs/resources/audit-log#audit-log-change-object-audit-log-change-exceptions)

* """fixed"""

* Fix typos

Co-authored-by: ITOH <to@itoh.at>

* deno fmt

Co-authored-by: ITOH <to@itoh.at>
Co-authored-by: Skillz4Killz <23035000+Skillz4Killz@users.noreply.github.com>
This commit is contained in:
LTS20050703
2022-05-16 19:45:56 +07:00
committed by GitHub
parent 6926ec1d29
commit 4aab0df69c
3 changed files with 109 additions and 19 deletions

View File

@@ -60,12 +60,12 @@ export async function getAuditLogs(bot: Bot, guildId: bigint, options?: GetGuild
/** https://discord.com/developers/docs/resources/audit-log#get-guild-audit-log-query-string-parameters */
export interface GetGuildAuditLog {
/** Filter the log for actions made by a user */
/** Entries from a specific user ID */
userId?: bigint | string;
/** The type of audit log event */
/** Entries for a specific audit log event */
actionType?: AuditLogEvents;
/** Filter the log before a certain entry id */
/** Entries that preceded a specific audit log entry ID */
before?: bigint | string;
/** How many entries are returned (default 50, minimum 1, maximum 100) */
/** Maximum number of entries (between 1-100) to return, defaults to 50 */
limit?: number;
}

View File

@@ -1389,11 +1389,14 @@ export interface DiscordAuditLog {
webhooks: DiscordWebhook[];
/** List of users found in the audit log */
users: DiscordUser[];
/** List of audit log entries */
/** List of audit log entries, sorted from most to least recent */
audit_log_entries: DiscordAuditLogEntry[];
/** List of partial integration objects */
integrations: Partial<DiscordIntegration>[];
/** List of threads found in the audit log. */
/**
* List of threads found in the audit log.
* Threads referenced in `THREAD_CREATE` and `THREAD_UPDATE` events are included in the threads map since archived threads might not be kept in memory by clients.
*/
threads: DiscordChannel[];
/** List of guild scheduled events found in the audit log */
guild_scheduled_events?: DiscordScheduledEvent[];
@@ -1401,19 +1404,19 @@ export interface DiscordAuditLog {
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-entry-structure */
export interface DiscordAuditLogEntry {
/** id of the affected entity (webhook, user, role, etc.) */
/** ID of the affected entity (webhook, user, role, etc.) */
target_id: string | null;
/** Changes made to the `target_id` */
changes?: DiscordAuditLogChange[];
/** The user who made the changes */
/** User or app that made the changes */
user_id: string | null;
/** id of the entry */
/** ID of the entry */
id: string;
/** Type of action that occurred */
action_type: AuditLogEvents;
/** Additional info for certain action types */
/** Additional info for certain event types */
options?: DiscordOptionalAuditEntryInfo;
/** The reason for the change (0-512 characters) */
/** Reason for the change (1-512 characters) */
reason?: string;
}
@@ -1513,22 +1516,60 @@ export type DiscordAuditLogChange =
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-optional-audit-entry-info */
export interface DiscordOptionalAuditEntryInfo {
/** Number of days after which inactive members were kicked */
/**
* Number of days after which inactive members were kicked.
*
* Event types: `MEMBER_PRUNE`
*/
delete_member_days: string;
/** Number of members removed by the prune */
/**
* Number of members removed by the prune.
*
* Event types: `MEMBER_PRUNE`
*/
members_removed: string;
/** Channel in which the entities were targeted */
/**
* Channel in which the entities were targeted.
*
* Event types: `MEMBER_MOVE`, `MESSAGE_PIN`, `MESSAGE_UNPIN`, `MESSAGE_DELETE`, `STAGE_INSTANCE_CREATE`, `STAGE_INSTANCE_UPDATE`, `STAGE_INSTANCE_DELETE`
*/
channel_id: string;
/** id of the message that was targeted, types: MESSAGE_PIN & MESSAGE_UNPIN & STAGE_INSTANCE_CREATE & STAGE_INSTANCE_UPDATE & STAGE_INSTANCE_DELETE */
/**
* ID of the message that was targeted.
*
* Event types: `MESSAGE_PIN`, `MESSAGE_UNPIN`, `STAGE_INSTANCE_CREATE`, `STAGE_INSTANCE_UPDATE`, `STAGE_INSTANCE_DELETE`
*/
message_id: string;
/** Number of entities that were targeted */
/**
* Number of entities that were targeted.
*
* Event types: `MESSAGE_DELETE`, `MESSAGE_BULK_DELETE`, `MEMBER_DISCONNECT`, `MEMBER_MOVE`
*/
count: string;
/** id of the overwritten entity */
/**
* ID of the overwritten entity.
*
* Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`
*/
id: string;
/** type of overwritten entity - "0", for "role", or "1" for "member" */
/**
* Type of overwritten entity - "0", for "role", or "1" for "member".
*
* Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`
*/
type: string;
/** Name of the role if type is "0" (not present if type is "1") */
/**
* Name of the role if type is "0" (not present if type is "1").
*
* Event types: `CHANNEL_OVERWRITE_CREATE`, `CHANNEL_OVERWRITE_UPDATE`, `CHANNEL_OVERWRITE_DELETE`
*/
role_name: string;
/**
* ID of the app whose permissions were targeted.
*
* Event types: `APPLICATION_COMMAND_PERMISSION_UPDATE`
*/
application_id: string;
}
export interface DiscordScheduledEvent {

View File

@@ -383,53 +383,102 @@ export enum ApplicationCommandOptionTypes {
/** https://discord.com/developers/docs/resources/audit-log#audit-log-entry-object-audit-log-events */
export enum AuditLogEvents {
/** Server settings were updated */
GuildUpdate = 1,
/** Channel was created */
ChannelCreate = 10,
/** Channel settings were updated */
ChannelUpdate,
/** Channel was deleted */
ChannelDelete,
/** Permission overwrite was added to a channel */
ChannelOverwriteCreate,
/** Permission overwrite was updated for a channel */
ChannelOverwriteUpdate,
/** Permission overwrite was deleted from a channel */
ChannelOverwriteDelete,
/** Member was removed from server */
MemberKick = 20,
/** Members were pruned from server */
MemberPrune,
/** Member was banned from server */
MemberBanAdd,
/** Server ban was lifted for a member */
MemberBanRemove,
/** Member was updated in server */
MemberUpdate,
/** Member was added or removed from a role */
MemberRoleUpdate,
/** Member was moved to a different voice channel */
MemberMove,
/** Member was disconnected from a voice channel */
MemberDisconnect,
/** Bot user was added to server */
BotAdd,
/** Role was created */
RoleCreate = 30,
/** Role was edited */
RoleUpdate,
/** Role was deleted */
RoleDelete,
/** Server invite was created */
InviteCreate = 40,
/** Server invite was updated */
InviteUpdate,
/** Server invite was deleted */
InviteDelete,
/** Webhook was created */
WebhookCreate = 50,
/** Webhook properties or channel were updated */
WebhookUpdate,
/** Webhook was deleted */
WebhookDelete,
/** Emoji was created */
EmojiCreate = 60,
/** Emoji name was updated */
EmojiUpdate,
/** Emoji was deleted */
EmojiDelete,
/** Single message was deleted */
MessageDelete = 72,
/** Multiple messages were deleted */
MessageBulkDelete,
/** Messaged was pinned to a channel */
MessagePin,
/** Message was unpinned from a channel */
MessageUnpin,
/** App was added to server */
IntegrationCreate = 80,
/** App was updated (as an example, its scopes were updated) */
IntegrationUpdate,
/** App was removed from server */
IntegrationDelete,
/** Stage instance was created (stage channel becomes live) */
StageInstanceCreate,
/** Stage instace details were updated */
StageInstanceUpdate,
/** Stage instance was deleted (stage channel no longer live) */
StageInstanceDelete,
/** Sticker was created */
StickerCreate = 90,
/** Sticker details were updated */
StickerUpdate,
/** Sticker was deleted */
StickerDelete,
/** Event was created */
GuildScheduledEventCreate = 100,
/** Event was updated */
GuildScheduledEventUpdate,
/** Event was cancelled */
GuildScheduledEventDelete,
/** Thread was created in a channel */
ThreadCreate = 110,
/** Thread was updated */
ThreadUpdate,
/** Thread was deleted */
ThreadDelete,
/** Permissions were updated for a command */
ApplicationCommandPermissionUpdate = 121,
}
export enum ScheduledEventPrivacyLevel {