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

fix(Guild): add invite manager property, extend CachedManager #6049

Merged
merged 3 commits into from Jul 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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