Starting stardboard
This commit is contained in:
parent
ba1ef05695
commit
fbc61f65a3
35
main.js
35
main.js
|
@ -1,4 +1,4 @@
|
||||||
const { Client, Collection, Events, GatewayIntentBits } = require('discord.js');
|
const { Client, Collection, Events, EmbedBuilder, GatewayIntentBits, Partials } = require('discord.js');
|
||||||
const { token } = require('./config.json');
|
const { token } = require('./config.json');
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
|
@ -7,7 +7,12 @@ const informationStatus = "[INFO]: ";
|
||||||
const warningStatus = "[WARNING]: ";
|
const warningStatus = "[WARNING]: ";
|
||||||
const errorStatus = "[ERROR]: ";
|
const errorStatus = "[ERROR]: ";
|
||||||
|
|
||||||
const client = new Client({ intents: [GatewayIntentBits.Guilds] });
|
const starChannelID = "1211566862148567091";
|
||||||
|
|
||||||
|
const client = new Client({
|
||||||
|
intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMessageReactions],
|
||||||
|
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
|
||||||
|
});
|
||||||
|
|
||||||
client.commands = new Collection();
|
client.commands = new Collection();
|
||||||
|
|
||||||
|
@ -70,4 +75,30 @@ client.on(Events.InteractionCreate, async interaction => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
client.on(Events.MessageReactionAdd, async (reaction, user) => {
|
||||||
|
if (reaction.partial) {
|
||||||
|
try {
|
||||||
|
await reaction.fetch();
|
||||||
|
|
||||||
|
const starChannel = client.channels.cache.get(starChannelID);
|
||||||
|
|
||||||
|
starChannel.send(reaction.message.attachments);
|
||||||
|
|
||||||
|
if (reaction.emoji.name == '⭐') {
|
||||||
|
const starEmbed = new EmbedBuilder()
|
||||||
|
//.setImage()
|
||||||
|
.setDescription(reaction.message.content)
|
||||||
|
.setAuthor({ name: `${reaction.message.author.tag}` });
|
||||||
|
starChannel.send({ embeds: [starEmbed] });
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.log(errorStatus + 'Something wrong happend while fetching reactions for message! Please use information below to debug.');
|
||||||
|
console.error(error);
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
client.login(token);
|
client.login(token);
|
||||||
|
|
1
star-count.json
Normal file
1
star-count.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
|
Loading…
Reference in a new issue