MysteryPancake / Discord-Reposter

Bot for reposting Discord messages (work in progress)
MIT License
92 stars 121 forks source link

Well it's kinda a question can be an enhancement about emojis #55

Closed dog-broad closed 3 years ago

dog-broad commented 3 years ago

I want the bot to be able to use all emotes, I mean all the emotes it has access to by being in other servers. I found this somewhere but don't know where to place it in the code. It would be great if someone can help. This will make the bot use the emotes from other servers which it is in. And yeah thus was the code I have seen Custom Emojis First, select a custom emoji and send it with a \ before it, like with Unicode emojis. Then, paste it into your code.

client.on('ready', () => { // Custom emojis are made like this: // <:name:ID> // If animated: //

let channel = client.guilds.get('guild_id').channels.get('channel_id');
channel.send('A custom emoji: <:Heart:301014681663832065>' + 
    '\nA custom **animated** emoji: <a:mop:428629994126704652>');

});

Type to search A Guide to Discord Bots Introduction Getting Started Events & The Documentation Prefix & More Commands Fetching Users & Members Awaiting Messages & Reactions Roles & Channels Permissions Custom & Animated Emojis Time-based Events Embeds Webhooks Hosting Your Bot Examples Ping and Uptime Kicking, Banning, Unbanning Restarting and Shutting Down Async/Await Promises Timeouts/Intervals (Timers) Sharding Storing Data Using JSON Using SQL Help / Tips Shortcuts Debugging / Testing Tips What's The Difference Between... Powered by GitBook A Guide to Discord Bots Custom & Animated Emojis Now this is something that not everyone know about, but it can make your bot unique. Your bot can use any emoji, even animated ones, from any server it is in.

Note: custom emojis are stored by their IDs at the following URLs: https://cdn.discordapp.com/emojis/EMOJI\_ID_HERE.png https://cdn.discordapp.com/emojis/EMOJI\_ID_HERE.gif (animated emojis only)

Discord & Unicode Emojis client.on('ready', () => { // Nothing special, users can do it too let channel = client.guilds.get('guild_id').channels.get('channel_id'); channel.send('A Unicode emoji: \:thumbsup:' + '\nA Discord emoji: :thumbsup:'); });

Custom Emojis First, select a custom emoji and send it with a \ before it, like with Unicode emojis. Then, paste it into your code.

client.on('ready', () => { // Custom emojis are made like this: // <:name:ID> // If animated: //

let channel = client.guilds.get('guild_id').channels.get('channel_id');
channel.send('A custom emoji: <:Heart:301014681663832065>' + 
    '\nA custom **animated** emoji: <a:mop:428629994126704652>');

}); Getting IDs easily If you don't have nitro, you can't send animated emojis to check their ID... Good thing you have a bot!

client.on('ready', () => { // Custom emojis are made like this: // <:name:ID> // If animated: //

// Getting all emojis from a server
client.guilds.get('guild_id').emojis.forEach(emoji => console.log(emoji.animated ? '<a:' + emoji.name + ':' + emoji.id + '>' : '<:' + emoji.name + ':' + emoji.id + '>'));

// A fancier way
let static = [], animated = [];
client.guilds.get('guild_id').emojis.forEach(emoji => emoji.animated ? animated.push([emoji.id, emoji.name]) : static.push([emoji.id, emoji.name]));

console.log('Static Emojis\n');
static.forEach(emoji => console.log('<:' + emoji[1] + ':' + emoji[0] + '>'));
console.log('\nAnimated Emojis\n');
animated.forEach(emoji => console.log('<a:' + emoji[1] + ':' + emoji[0] + '>'));

// You can copy/paste the emojis you want into your code
// It will not work if you paste them into Discord

}); Now, you can just make server only for your bot, and put emojis in them! Enjoy ^.^ I have pasted everything I have seen there so bear with it😅

MysteryPancake commented 3 years ago

I think this bot should already be able to repost emojis and reactions from other servers it's on.

Is there something broken with emojis/reactions at the moment?

dog-broad commented 3 years ago

Well nope that doesn't happen I'll show you some pics Screenshot_20201123-110704 Screenshot_20201123-110709 Screenshot_20201123-110744 Screenshot_20201123-110749

dog-broad commented 3 years ago

The last 2 images are from a diff server where the arceus emote is present