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 Userā€¢17mo ago
Message Not Public
Sign In & Join Server To View
Parogo_72
Parogo_72ā€¢17mo ago
client.emojis.cache.get(id) exists
Hugo4774
Hugo4774ā€¢17mo ago
TypeError: Cannot read properties of undefined (reading 'cache') client.emojis is undefined in my case and idk why
chewie šŸŒˆ
chewie šŸŒˆā€¢17mo ago
then client isn't a client object
Hugo4774
Hugo4774ā€¢17mo 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 šŸŒˆ
chewie šŸŒˆā€¢17mo ago
Show how you defined it.
Hugo4774
Hugo4774ā€¢17mo 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 šŸŒˆ
chewie šŸŒˆā€¢17mo ago
and now show the command file Cuz I'm gonna bet you are accessing Discord instead of client
Hugo4774
Hugo4774ā€¢17mo ago
execute(message, args, client) {
console.log(client.emojis.cache.get(id));
...
}
execute(message, args, client) {
console.log(client.emojis.cache.get(id));
...
}
chewie šŸŒˆ
chewie šŸŒˆā€¢17mo ago
yep, what I said
d.js docs
d.js docsā€¢17mo 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
Hugo4774ā€¢17mo ago
i found the solution : execute(message, args, Discord, client) { it's a missmatch yes ty