Skip to content

Commit

Permalink
fix(Guild): add invite manager property, extend CachedManager (#6049)
Browse files Browse the repository at this point in the history
Co-authored-by: SpaceEEC <spaceeec@yahoo.com>
  • Loading branch information
monbrey and SpaceEEC committed Jul 5, 2021
1 parent fe5d56c commit e3d877d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/managers/GuildInviteManager.js
@@ -1,18 +1,18 @@
'use strict';

const BaseManager = require('./BaseManager');
const CachedManager = require('./CachedManager');
const { Error } = require('../errors');
const Invite = require('../structures/Invite');
const Collection = require('../util/Collection');
const DataResolver = require('../util/DataResolver');

/**
* Manages API methods for GuildInvites and stores their cache.
* @extends {BaseManager}
* @extends {CachedManager}
*/
class GuildInviteManager extends BaseManager {
class GuildInviteManager extends CachedManager {
constructor(guild, iterable) {
super(guild.client, iterable, Invite);
super(guild.client, Invite, iterable);

/**
* The guild this Manager belongs to
Expand Down
7 changes: 7 additions & 0 deletions src/structures/Guild.js
Expand Up @@ -12,6 +12,7 @@ const GuildApplicationCommandManager = require('../managers/GuildApplicationComm
const GuildBanManager = require('../managers/GuildBanManager');
const GuildChannelManager = require('../managers/GuildChannelManager');
const GuildEmojiManager = require('../managers/GuildEmojiManager');
const GuildInviteManager = require('../managers/GuildInviteManager');
const GuildMemberManager = require('../managers/GuildMemberManager');
const PresenceManager = require('../managers/PresenceManager');
const RoleManager = require('../managers/RoleManager');
Expand Down Expand Up @@ -90,6 +91,12 @@ class Guild extends AnonymousGuild {
*/
this.stageInstances = new StageInstanceManager(this);

/**
* A manager of the invites of this guild
* @type {GuildInviteManager}
*/
this.invites = new GuildInviteManager(this);

/**
* Whether the bot has been removed from the guild
* @type {boolean}
Expand Down
2 changes: 1 addition & 1 deletion typings/index.d.ts
Expand Up @@ -859,14 +859,14 @@ declare module 'discord.js' {
public approximatePresenceCount: number | null;
public available: boolean;
public bans: GuildBanManager;
public invites: GuildInviteManager;
public channels: GuildChannelManager;
public commands: GuildApplicationCommandManager;
public defaultMessageNotifications: DefaultMessageNotificationLevel | number;
public deleted: boolean;
public discoverySplash: string | null;
public emojis: GuildEmojiManager;
public explicitContentFilter: ExplicitContentFilterLevel;
public invites: GuildInviteManager;
public readonly joinedAt: Date;
public joinedTimestamp: number;
public large: boolean;
Expand Down

0 comments on commit e3d877d

Please sign in to comment.