最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Send a custom emoji to another server with Discord.js - Stack Overflow

programmeradmin0浏览0评论

So lets say a Discord bot is a member of server A and server B, and there is a custom emoji being hosted on server A. How do I get the bot to send the emoji on server B? I have seen bots such as MEE6 that can send custom emojis in DMs, so this surely must be possible.

I have tried both this:

message.channel.send('Test <:[emoji_name]:[id]>');

and this:

message.channel.send(`Test ${client.guilds.cache.get('[server_id]').emojis.cache.first()}`);

I used .first() since there is only one emoji in the server.

Both of these do not work. The emoji will appear in the server it is hosted in, but if I try to send it in any other server, it just shows the emoji name and/or ID. I cannot find any articles or questions that provide any other way of doing this. So in short, how do I get the bot to send an emoji to another server that the emoji isn't being hosted on?

So lets say a Discord bot is a member of server A and server B, and there is a custom emoji being hosted on server A. How do I get the bot to send the emoji on server B? I have seen bots such as MEE6 that can send custom emojis in DMs, so this surely must be possible.

I have tried both this:

message.channel.send('Test <:[emoji_name]:[id]>');

and this:

message.channel.send(`Test ${client.guilds.cache.get('[server_id]').emojis.cache.first()}`);

I used .first() since there is only one emoji in the server.

Both of these do not work. The emoji will appear in the server it is hosted in, but if I try to send it in any other server, it just shows the emoji name and/or ID. I cannot find any articles or questions that provide any other way of doing this. So in short, how do I get the bot to send an emoji to another server that the emoji isn't being hosted on?

Share Improve this question edited Oct 6, 2020 at 2:49 RyDev asked Oct 6, 2020 at 2:41 RyDevRyDev 1573 silver badges10 bronze badges 3
  • 1 Have you tried using client.emojis.get("<Emoji ID>")? If I remember correctly, that's the way to achieve your goal. – wgumenyuk Commented Oct 6, 2020 at 9:00
  • @wgumenyuk Thank you! This worked perfectly. If you turn this into an answer I’ll accept it. – RyDev Commented Oct 6, 2020 at 13:53
  • Glad I could help! :) – wgumenyuk Commented Oct 6, 2020 at 14:16
Add a ment  | 

2 Answers 2

Reset to default 4

in discord.js v12 it is

const someEmoji = client.emojis.cache.get("<Emoji ID>");

For everyone facing the same issue, you can use client.emojis.get("<Emoji ID>").

Here's a quick example:

const someEmoji = client.emojis.get("<Emoji ID>");

message.channel.send(someEmoji);
发布评论

评论列表(0)

  1. 暂无评论