more more
All checks were successful
Deploy bot / build-and-deploy (push) Successful in 14s

This commit is contained in:
2025-08-07 23:56:07 +02:00
parent 2594991b21
commit dfc14f7f33
8 changed files with 38 additions and 7 deletions

View File

@ -19,6 +19,7 @@ const client = new Client({
],
});
client.commands = new Collection();
client.ownerID = 263247134147608578;
fs.readdir("./commands/", (err, files) => {
if (err) return console.error(err);
@ -32,12 +33,12 @@ fs.readdir("./commands/", (err, files) => {
});
const url = "https://drive.overflow.fun/public/react.json";
let userstoreact = [];
client.usersToReactTo = [];
client.once(Events.ClientReady, async (readyClient) => {
const res = await fetch(url);
const data = await res.json();
userstoreact = data.map((entry) => {
client.usersToReactTo = data.map((entry) => {
const [userId, emoji] = entry.split(":");
return { userId, emoji };
});
@ -46,12 +47,14 @@ client.once(Events.ClientReady, async (readyClient) => {
client.on(Events.MessageCreate, async (message) => {
if (message.author.bot) return;
console.log(message.mentions.users);
userstoreact.forEach(async (usr) => {
if (message.mentions.users.find((u) => u.id == usr.userId)) {
client.usersToReactTo.forEach(async (item) => {
if (
message.mentions.users.find((u) => u.id == item.userId) &&
!message.reference
) {
try {
await message.react(usr.emoji);
await message.react(item.emoji);
} catch (err) {
console.error("Failed to react to message:", err);
}
@ -67,7 +70,7 @@ client.on(Events.MessageCreate, async (message) => {
if (!cmd) return;
cmd.run(client, message, args);
await cmd.run(client, message, args);
});
// Log in to Discord with your client's token