How Find Emojis By Name In Discord.js

后端 未结 4 1095
渐次进展
渐次进展 2021-01-24 08:01

So I have been utterly frustrated these past few days because I have not been able to find a single resource online which properly documents how to find emojis when writing a di

4条回答
  •  时光取名叫无心
    2021-01-24 08:38

    I've made changes to your code.

    I hope it'll help you!

    const Discord = require("discord.js");
    const client = new Discord.Client();
    
    
    client.on('ready', () => {
    	console.log('ready');
    });
    
    
    client.on('message', message => {
    	var bean = message.guild.emojis.find(emoji => emoji.name == 'bean');
    	// By guild id 
    	if(message.guild.id == 'your guild id') {
    	if(bean) {
        		if(message.content.startsWith("<:bean:" + bean.id + ">")) {
        			message.react(bean.id);
        		}
        	}
    }
    });

提交回复
热议问题