Skip to content

Commit 7b9a55e

Browse files
authored
Revert "fix(GuildEmojiManager): check for guild in methods that use it (#4886)"
This reverts commit 728b3f9.
1 parent 728b3f9 commit 7b9a55e

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

src/errors/Messages.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,6 @@ const Messages = {
103103
FETCH_GROUP_DM_CHANNEL: "Bots don't have access to Group DM Channels and cannot fetch them",
104104

105105
MEMBER_FETCH_NONCE_LENGTH: 'Nonce length must not exceed 32 characters.',
106-
107-
GUILDEMOJIMANAGER_NO_GUILD: 'Method cannot be called from a Client instance.',
108106
};
109107

110108
for (const [name, message] of Object.entries(Messages)) register(name, message);

src/managers/GuildEmojiManager.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
const BaseManager = require('./BaseManager');
4-
const { Error, TypeError } = require('../errors');
4+
const { TypeError } = require('../errors');
55
const GuildEmoji = require('../structures/GuildEmoji');
66
const ReactionEmoji = require('../structures/ReactionEmoji');
77
const Collection = require('../util/Collection');
@@ -16,9 +16,9 @@ class GuildEmojiManager extends BaseManager {
1616
super(guild.client, iterable, GuildEmoji);
1717
/**
1818
* The guild this manager belongs to
19-
* @type {?Guild}
19+
* @type {Guild}
2020
*/
21-
this.guild = 'name' in guild ? guild : null;
21+
this.guild = guild;
2222
}
2323

2424
/**
@@ -28,7 +28,6 @@ class GuildEmojiManager extends BaseManager {
2828
*/
2929

3030
add(data, cache) {
31-
if (!this.guild) throw new Error('GUILDEMOJIMANAGER_NO_GUILD');
3231
return super.add(data, cache, { extras: [this.guild] });
3332
}
3433

@@ -52,7 +51,6 @@ class GuildEmojiManager extends BaseManager {
5251
* .catch(console.error);
5352
*/
5453
async create(attachment, name, { roles, reason } = {}) {
55-
if (!this.guild) throw new Error('GUILDEMOJIMANAGER_NO_GUILD');
5654
attachment = await DataResolver.resolveImage(attachment);
5755
if (!attachment) throw new TypeError('REQ_RESOURCE_TYPE');
5856

typings/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1917,7 +1917,7 @@ declare module 'discord.js' {
19171917

19181918
export class GuildEmojiManager extends BaseManager<Snowflake, GuildEmoji, EmojiResolvable> {
19191919
constructor(guild: Guild, iterable?: Iterable<any>);
1920-
public guild: Guild | null;
1920+
public guild: Guild;
19211921
public create(
19221922
attachment: BufferResolvable | Base64Resolvable,
19231923
name: string,

0 commit comments

Comments
 (0)