Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types(GuildAuditLogs): Allow fetching to return all possible values #8522

Merged
merged 3 commits into from Aug 20, 2022

Conversation

Jiralite
Copy link
Member

Please describe the changes this PR makes and why it should be merged:
This resolves #8275. To explain: the issue was that calling <Guild>.fetchAuditLogs() (or <Guild>.fetchAuditLogs({ type: null })) would incorrectly assume that the returned action is always null, actionType is always ALL, extra is always null etc. instead of leaving these as all possible values.

A code sample of how this bug was in effect:

import { AuditLogEvent, Guild } from "discord.js";

declare const guild: Guild;
const auditLog = await guild.fetchAuditLogs().then(({ entries }) => entries.first()!);

// We didn't specify a specific type to fetch. Therefore, it could be anything.
if (auditLog.action === AuditLogEvent.BotAdd) {
  // never
}

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

@vercel
Copy link

vercel bot commented Aug 18, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
discord-js ⬜️ Ignored (Inspect) Aug 20, 2022 at 6:59PM (UTC)

@Jiralite Jiralite added this to the discord.js v14.3 milestone Aug 18, 2022
@Jiralite Jiralite marked this pull request as draft August 19, 2022 00:26
@Jiralite Jiralite force-pushed the fix/fetch-audit-logs-default branch 2 times, most recently from bcaf81c to c3d21d6 Compare August 19, 2022 00:48
@Jiralite Jiralite marked this pull request as ready for review August 19, 2022 00:53
@codecov
Copy link

codecov bot commented Aug 19, 2022

Codecov Report

Merging #8522 (cb29146) into main (8028813) will increase coverage by 7.65%.
The diff coverage is n/a.

❗ Current head cb29146 differs from pull request most recent head c88c5cd. Consider uploading reports for the commit c88c5cd to get more accurate results

@@            Coverage Diff             @@
##             main    #8522      +/-   ##
==========================================
+ Coverage   78.73%   86.38%   +7.65%     
==========================================
  Files          22       87      +65     
  Lines        3503     8418    +4915     
  Branches      320     1105     +785     
==========================================
+ Hits         2758     7272    +4514     
- Misses        741     1103     +362     
- Partials        4       43      +39     
Flag Coverage Δ
builders 100.00% <ø> (?)
collection 100.00% <ø> (?)
proxy 73.28% <ø> (?)
rest 92.53% <ø> (ø)
utilities 100.00% <ø> (?)
voice 64.08% <ø> (?)
ws 59.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/collection/src/collection.ts 100.00% <0.00%> (ø)
...s/src/interactions/slashCommands/options/number.ts 100.00% <0.00%> (ø)
.../interactions/slashCommands/options/mentionable.ts 100.00% <0.00%> (ø)
...ionCommandOptionWithChoicesAndAutocompleteMixin.ts 100.00% <0.00%> (ø)
packages/builders/src/components/Components.ts 100.00% <0.00%> (ø)
...s/src/interactions/slashCommands/options/string.ts 100.00% <0.00%> (ø)
.../slashCommands/mixins/SharedSlashCommandOptions.ts 100.00% <0.00%> (ø)
...s/contextMenuCommands/ContextMenuCommandBuilder.ts 100.00% <0.00%> (ø)
...ers/src/interactions/slashCommands/options/user.ts 100.00% <0.00%> (ø)
packages/voice/src/util/util.ts 100.00% <0.00%> (ø)
... and 55 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Jiralite Jiralite force-pushed the fix/fetch-audit-logs-default branch from c3d21d6 to cb29146 Compare August 19, 2022 00:55
@vercel vercel bot temporarily deployed to Preview August 20, 2022 18:37 Inactive
@Jiralite Jiralite added blocked and removed blocked labels Aug 20, 2022
@kodiakhq kodiakhq bot merged commit 0dba8ad into discordjs:main Aug 20, 2022
@Jiralite Jiralite deleted the fix/fetch-audit-logs-default branch August 20, 2022 19:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

GuildAuditLogsEntry Typings Bug
4 participants