Chrissy
Chrissy
Explore posts from servers
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/29/2024 in #djs-questions
discord.js polls seem to not work
No description
7 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/29/2024 in #djs-questions
discord.js polls seem to not work
great
7 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/29/2024 in #djs-questions
discord.js polls seem to not work
when will it be merged/released?
7 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/29/2024 in #djs-questions
discord.js polls seem to not work
cool, thanks
7 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
Weird behaviour from pins, caused by discord.js
reinstalling discord.js fixed it lol
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
Weird behaviour from pins, caused by discord.js
so when you pin a message for you the messageUpdate event triggers?
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
Weird behaviour from pins, caused by discord.js
No description
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
Weird behaviour from pins, caused by discord.js
No description
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
Weird behaviour from pins, caused by discord.js
debug it:
client.on("raw", d => d.t !== "PRESENCE_UPDATE" && console.log(d));
client.on("channelPinsUpdate", () => console.log("channelPinsUpdate"));
client.on("messageUpdate", () => console.log("messageUpdate"));
client.on("raw", d => d.t !== "PRESENCE_UPDATE" && console.log(d));
client.on("channelPinsUpdate", () => console.log("channelPinsUpdate"));
client.on("messageUpdate", () => console.log("messageUpdate"));
on pin the messageUpdate never fires, but it's inside the raw event
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
Weird behaviour from pins, caused by discord.js
But it could also be acomplished by triggering messageUpdate
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
Weird behaviour from pins, caused by discord.js
the message also get's automatically added to the cache, even when i clear it, but the event doesn't trigger
const pinAudit = cache.auditLog.getAudit(textChannel.guild?.id, AuditLogEvent.MessagePin).actions.filter(v => Date.now() - v.savedAt <= 750 && v.options.channel_id === textChannel.id).sort((a, b) => a.savedAt < b.savedAt ? 1 : a.savedAt > b.savedAt ? -1 : 0)[0];

const unPinAudit = cache.auditLog.getAudit(textChannel.guild?.id, AuditLogEvent.MessageUnpin).actions.filter(v => Date.now() - v.savedAt <= 750 && v.options.channel_id === textChannel.id).sort((a, b) => a.savedAt < b.savedAt ? 1 : a.savedAt > b.savedAt ? -1 : 0)[0];

const gotPinned = pinAudit ? true : unPinAudit ? false : null;

const auditData = pinAudit || unPinAudit || { options: { channel_id: null, message_id: null }, target: null, deleteAt: null, savedAt: null, executor: null, keyChanges: null, reason: null, id: null };

const author_id = auditData.target, { message_id, channel_id } = auditData.options;

if(message_id || author_id) {
const message = textChannel.messages.cache.get(message_id);
const fetched = !message ? await textChannel.messages.fetch(message_id).catch(() => null) : undefined;

console.log(`message by ${client.users.cache.get(author_id)?.username||"Unknown"} got ${typeof gotPinned === "boolean" ? gotPinned ? "pinned" : "unpinned" : "N/A"} - CACHE: ${message?.url||"N/A"} - FETCH: ${fetched?.url||"N/A"}`)
} else {
console.log("message pin updated happened...")
}
const pinAudit = cache.auditLog.getAudit(textChannel.guild?.id, AuditLogEvent.MessagePin).actions.filter(v => Date.now() - v.savedAt <= 750 && v.options.channel_id === textChannel.id).sort((a, b) => a.savedAt < b.savedAt ? 1 : a.savedAt > b.savedAt ? -1 : 0)[0];

const unPinAudit = cache.auditLog.getAudit(textChannel.guild?.id, AuditLogEvent.MessageUnpin).actions.filter(v => Date.now() - v.savedAt <= 750 && v.options.channel_id === textChannel.id).sort((a, b) => a.savedAt < b.savedAt ? 1 : a.savedAt > b.savedAt ? -1 : 0)[0];

const gotPinned = pinAudit ? true : unPinAudit ? false : null;

const auditData = pinAudit || unPinAudit || { options: { channel_id: null, message_id: null }, target: null, deleteAt: null, savedAt: null, executor: null, keyChanges: null, reason: null, id: null };

const author_id = auditData.target, { message_id, channel_id } = auditData.options;

if(message_id || author_id) {
const message = textChannel.messages.cache.get(message_id);
const fetched = !message ? await textChannel.messages.fetch(message_id).catch(() => null) : undefined;

console.log(`message by ${client.users.cache.get(author_id)?.username||"Unknown"} got ${typeof gotPinned === "boolean" ? gotPinned ? "pinned" : "unpinned" : "N/A"} - CACHE: ${message?.url||"N/A"} - FETCH: ${fetched?.url||"N/A"}`)
} else {
console.log("message pin updated happened...")
}
therefore i managed to create such a tool, to find the message that got pinned via channelPinsUpdate event. (a fetch is never required)
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by Chrissy on 6/25/2024 in #djs-questions
Weird behaviour from pins, caused by discord.js
i have partials enabled, it's for both partial and not partial messages
13 replies
DIAdiscord.js - Imagine a boo! 👻
Created by awdev on 4/2/2024 in #djs-questions
Embed and console desync
it could be that roles.members is not valid I'd recommend to call the updateMembersRoles Function through the interaction and get the members like that: // for every role: guild.members.cache. filter(member => member.roles.cache.has(roleId).map(member => member.toString());
17 replies
DIAdiscord.js - Imagine a boo! 👻
Created by awdev on 4/2/2024 in #djs-questions
Embed and console desync
Wait does the embed just not update or the roles not?
17 replies
DIAdiscord.js - Imagine a boo! 👻
Created by awdev on 4/2/2024 in #djs-questions
Embed and console desync
add logs to your if statement:
if (member.roles.cache.has(role.id)) {
console.log("adding role")
await member.roles.remove(role);
} else {
console.log("removing role")
await member.roles.add(role);
}
if (member.roles.cache.has(role.id)) {
console.log("adding role")
await member.roles.remove(role);
} else {
console.log("removing role")
await member.roles.add(role);
}
`
17 replies