Skip to content

Commit

Permalink
fix: throw on webhook member fetch (#236)
Browse files Browse the repository at this point in the history
Co-authored-by: Nico <[email protected]>
  • Loading branch information
Isa and zaida04 authored Jul 4, 2023
1 parent e9ae297 commit 4f283ec
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/early-hats-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"guilded.js": patch
---

Issue with member.fetch in which it fetches user even if it is a webhook
2 changes: 2 additions & 0 deletions packages/guilded.js/lib/managers/global/MemberManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ export class GlobalMemberManager extends CacheableStructManager<string, Member>
* @returns A Promise that resolves with the fetched member.
*/
async fetch(serverId: string, userId: string, force?: boolean): Promise<Member> {
if (userId === "Ann6LewA") throw new Error("You cannot fetch a webhook as a member. The provided ID (Ann6LewA) is only given to webhooks.");

const memberKey = buildMemberKey(serverId, userId);
if (!force) {
const existingMember = this.client.members.cache.get(memberKey);
Expand Down

0 comments on commit 4f283ec

Please sign in to comment.