久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何讓機器人發送個性化的表情符號?

How to make the bot send personalized emojis?(如何讓機器人發送個性化的表情符號?)
本文介紹了如何讓機器人發送個性化的表情符號?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

嗯,我目前正在使用表情符號 :x:,但在我的服務器上我有一個名為 :superbotxemoji 的表情符號:我只是不知道我是怎么做到的讓我的機器人使用它

我的代碼:

const Discord = require('discord.js');模塊.exports = {名稱:'說',描述:'說',執行(消息,參數){const { 前綴,令牌 } = require('../config.json');if (!message.member.hasPermission('ADMINISTRATOR'))返回 message.channel.send({嵌入:{顏色:16777201,描述:`:x:|${message.author}, 你不能使用這個命令.`,頁腳:{文本:` |所需權限:管理員`,},},});如果(!args.length)返回 message.channel.send({嵌入:{顏色:16777201,描述:`:x:|${message.author}, 你需要發消息.`,頁腳:{文本:` |示例:!打個招呼`,},},});const sayMessage = args.join(' ');message.delete({ timeout: 1 });message.channel.send(sayMessage);},};

解決方案

其實官方discord.js指南里面有非常詳細的解釋,你可以找到 集合和 .find() 方法.

client.emojis.cache.find(emoji => emoji.name === '<表情符號的名稱>')

此方法還可以發送自定義表情符號,但是這次您可以通過名稱找到它們.請注意,如果給定名稱的表情符號不止一個,它將不起作用.

繞過這個問題的一種方法是查看 guild.emojis.cache 集合.這樣可以減少可能重復的表情符號數量.

Well, I'm currently using the emoji :x:, but on my server I have an emoji called :superbotxemoji: I just don't know how I get my bot to use it

My code:

const Discord = require('discord.js');

module.exports = {
 name: 'say',
 description: 'say',
 execute(message, args) {
  const { prefix, token } = require('../config.json');

  if (!message.member.hasPermission('ADMINISTRATOR'))
   return message.channel.send({
    embed: {
     color: 16777201,
     description: `:x: | ${message.author}, You are not allowed to use this command.`,
     footer: {
      text: `   | Required permission: ADMINISTRATOR`,
     },
    },
   });

  if (!args.length)
   return message.channel.send({
    embed: {
     color: 16777201,
     description: `:x: | ${message.author}, You need to put a message.`,
     footer: {
      text: `   | Example: !say hello`,
     },
    },
   });

  const sayMessage = args.join(' ');
  message.delete({ timeout: 1 });
  message.channel.send(sayMessage);
 },
};

解決方案

There is actually a very detailed explanation from the official discord.js guide which you can find here, although I'll try to paraphrase it.

To send a custom emoji, you must get that emoji's unique ID. To find that, you must send the emote in discord with a backslash in front of it; essentially escaping the emoji.

This will result in the emojis unique ID in this format: <:emoji-name:emoji-id>

If you paste this special string into a message, the bot will send the emoji. However, the emoji must be from a guild the bot is part of.

On the other hand, there's another very easy way to get an emoji using the client.emojis.cache collection and the .find() method.

client.emojis.cache.find(emoji => emoji.name === '<name of emoji>')

This method will also make it possible to send custom emojis, however, this time you can find them by name. Be careful, if there are more than one emojis by the given name, it will not work.

A way to bypass this problem would be looking at a guild.emojis.cache collection. This way the amount of possible duplicate emojis would be narrowed down.

這篇關于如何讓機器人發送個性化的表情符號?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 中文字幕在线一区 | 91精品国产91久久久久久三级 | 亚洲国产成人在线视频 | 午夜精品网站 | 美女啪啪国产 | 亚洲免费在线 | 国产综合在线视频 | 成人午夜免费福利视频 | 999www视频免费观看 | 亚洲一区| 日韩精品在线观看网站 | 精品久久久久久 | 91一区| av香蕉 | 亚洲福利精品 | 国产精品久久久久久久久免费丝袜 | 超碰成人在线观看 | 台湾佬久久| 欧美精品一区二区免费 | 成年人在线视频 | 国产探花在线精品一区二区 | 亚洲区一区二 | 久久一区二区三区免费 | 国产精品久久久久久久久久免费看 | 91中文| 久久精品国产99国产 | 成人精品一区 | 中文日韩在线视频 | 亚洲精品久久区二区三区蜜桃臀 | 亚洲三级免费看 | 久久成人国产 | 伦理一区二区 | www成人免费视频 | 亚洲三区视频 | 精品久久久久久亚洲精品 | 国产精品一区二 | 久久久精品久久久 | 日本三级视频 | 99久久精品国产麻豆演员表 | 国产亚洲精品区 | 国产情侣激情 |