get emoji with his id in 14.3.0

message.guild.emojis.cache.get(emojiA) Can i do more easily than that ? I tried client.emojis.resolve(emojiA) and client.emojis.cache.resolve(emojiA) but it doesn't work
12 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Parogo_72
Parogo_722y ago
client.emojis.cache.get(id) exists
Hugo4774
Hugo4774OP2y ago
TypeError: Cannot read properties of undefined (reading 'cache') client.emojis is undefined in my case and idk why
chewie
chewie2y ago
then client isn't a client object
Hugo4774
Hugo4774OP2y ago
well, i logged client and got that :
{
BaseClient: [class BaseClient extends EventEmitter],
Client: [class Client extends BaseClient],
Shard: [class Shard extends EventEmitter],
ShardClientUtil: [class ShardClientUtil],
ShardingManager: [class ShardingManager extends EventEmitter],
WebhookClient: [class WebhookClient extends BaseClient],`
...
{
BaseClient: [class BaseClient extends EventEmitter],
Client: [class Client extends BaseClient],
Shard: [class Shard extends EventEmitter],
ShardClientUtil: [class ShardClientUtil],
ShardingManager: [class ShardingManager extends EventEmitter],
WebhookClient: [class WebhookClient extends BaseClient],`
...
chewie
chewie2y ago
Show how you defined it.
Hugo4774
Hugo4774OP2y ago
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
const client = new Client({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessageReactions
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
`
client.on('messageCreate', message => {
...

command.execute(message, args, Discord, client);
...
});
client.on('messageCreate', message => {
...

command.execute(message, args, Discord, client);
...
});
index.js (I'm in the execute of a command)
chewie
chewie2y ago
and now show the command file Cuz I'm gonna bet you are accessing Discord instead of client
Hugo4774
Hugo4774OP2y ago
execute(message, args, client) {
console.log(client.emojis.cache.get(id));
...
}
execute(message, args, client) {
console.log(client.emojis.cache.get(id));
...
}
chewie
chewie2y ago
yep, what I said
d.js docs
d.js docs2y ago
The order of function parameters must match between definition and function call.
function execute(client, message, args) { ... };
execute(message, client, args);
function execute(client, message, args) { ... };
execute(message, client, args);
• mismatch! you pass a Message where the client is expected • mismatch! you pass the Client where a Message is expected
Hugo4774
Hugo4774OP2y ago
i found the solution : execute(message, args, Discord, client) { it's a missmatch yes ty
Want results from more Discord servers?
Add your server