Frosty
Frosty
DIAdiscord.js - Imagine an app
Created by Frosty on 11/1/2023 in #djs-questions
Getting the executor from Audit Logs
Hello i have this code:
const fetchedLogs = await oldMember.guild.fetchAuditLogs({
limit: 1,
type: AuditLogEvent.MemberUpdate,
});

const userWhoDidIt = fetchedLogs.entries.first();
const executor = userWhoDidIt.executor
const fetchedLogs = await oldMember.guild.fetchAuditLogs({
limit: 1,
type: AuditLogEvent.MemberUpdate,
});

const userWhoDidIt = fetchedLogs.entries.first();
const executor = userWhoDidIt.executor
But the userWhoDidIt is undefined
33 replies
DIAdiscord.js - Imagine an app
Created by Frosty on 8/24/2022 in #djs-questions
Image doesn't work in embed
Hello, i wanna make it so it puts one of the banners i have in kurtz-banners.json. It should randomly choose 1 but it doesnt put any image. When i specifically put one in there, then it works:
const { k_BannerOne, k_BannerTwo, k_BannerThree, k_BannerFour,
k_BannerFive, k_BannerSix, k_BannerServen, k_BannerEight
} = require("../../configuration/kurtz-Banners.json")

let banners = [k_BannerOne, k_BannerTwo, k_BannerThree, k_BannerFour, k_BannerFive, k_BannerSix, k_BannerServen, k_BannerEight];

let randomBanner = Math.floor((Math.random() * banners.length));

.setImage(`${banners[randomBanner]}`)
const { k_BannerOne, k_BannerTwo, k_BannerThree, k_BannerFour,
k_BannerFive, k_BannerSix, k_BannerServen, k_BannerEight
} = require("../../configuration/kurtz-Banners.json")

let banners = [k_BannerOne, k_BannerTwo, k_BannerThree, k_BannerFour, k_BannerFive, k_BannerSix, k_BannerServen, k_BannerEight];

let randomBanner = Math.floor((Math.random() * banners.length));

.setImage(`${banners[randomBanner]}`)
2 replies
DIAdiscord.js - Imagine an app
Created by Frosty on 7/22/2022 in #djs-questions
Leaderboard problem
Hello i have this code:
setInterval(async function () {

const correctServer = client.guilds.cache.get("878417329833259048")

let leaderBoardMessage = "1000082958209790013"
let leaderboardChannel = correctServer.channels.cache.get("999854180879585421")

const leaderBoardMessageEdit = await leaderboardChannel.messages.fetch(leaderBoardMessage)

let membersHat = await correctServer.members.cache.filter(
(member) =>
member.nickname && member.nickname.toLowerCase().includes("🎩") ||
member.username && member.username.toLowerCase().includes("🎩")
);
if (membersHat.size === 0) console.log("No members found");

let countHat = 0;
membersHat.forEach((member) => {
countHat = countHat + 1;
});

let membersBone = await correctServer.members.cache.filter(
(member) =>
member.nickname && member.nickname.toLowerCase().includes("🦴")
);
if (membersBone.size === 0) console.log("No members found");

let countBone = 0;
membersBone.forEach((member) => {
countBone = countBone + 1;
});

let leaderBoardEmbed = new MessageEmbed()
.setTitle("Clan War Leaderboard")
.setDescription(`🎩 - ${countHat} Members\n\n🦴 - ${countBone} Members`)
.setColor("BLUE")
.setFooter({ text: "Updating every 600 seconds!"})
return leaderBoardMessageEdit.edit({ embeds: [leaderBoardEmbed]

})
}, 600000);
setInterval(async function () {

const correctServer = client.guilds.cache.get("878417329833259048")

let leaderBoardMessage = "1000082958209790013"
let leaderboardChannel = correctServer.channels.cache.get("999854180879585421")

const leaderBoardMessageEdit = await leaderboardChannel.messages.fetch(leaderBoardMessage)

let membersHat = await correctServer.members.cache.filter(
(member) =>
member.nickname && member.nickname.toLowerCase().includes("🎩") ||
member.username && member.username.toLowerCase().includes("🎩")
);
if (membersHat.size === 0) console.log("No members found");

let countHat = 0;
membersHat.forEach((member) => {
countHat = countHat + 1;
});

let membersBone = await correctServer.members.cache.filter(
(member) =>
member.nickname && member.nickname.toLowerCase().includes("🦴")
);
if (membersBone.size === 0) console.log("No members found");

let countBone = 0;
membersBone.forEach((member) => {
countBone = countBone + 1;
});

let leaderBoardEmbed = new MessageEmbed()
.setTitle("Clan War Leaderboard")
.setDescription(`🎩 - ${countHat} Members\n\n🦴 - ${countBone} Members`)
.setColor("BLUE")
.setFooter({ text: "Updating every 600 seconds!"})
return leaderBoardMessageEdit.edit({ embeds: [leaderBoardEmbed]

})
}, 600000);
It doesn't update the embed, it says that no member found on the consol, but people have the hat emoji in their name.
13 replies
DIAdiscord.js - Imagine an app
Created by Frosty on 7/18/2022 in #djs-questions
Unbanning all members
Hello, i want my bot to unban all banned people from the server, how can i do it?
34 replies
DIAdiscord.js - Imagine an app
Created by Frosty on 7/4/2022 in #djs-questions
Finding members with specific emoji in their name problem.
I have this kind of code i made:
callback: async ({ message, args }) => {

const emojiInName = ["🎩"]
let members = await message.guild.members.fetch();
for(let member of members)
if(emojiInName.some(emoji => member.nickname.includes(emoji))){
message.channel.send({ content: `${member} has the emoji in name`})
} else return;

},
callback: async ({ message, args }) => {

const emojiInName = ["🎩"]
let members = await message.guild.members.fetch();
for(let member of members)
if(emojiInName.some(emoji => member.nickname.includes(emoji))){
message.channel.send({ content: `${member} has the emoji in name`})
} else return;

},
But i get this: TypeError: Cannot read properties of undefined (reading 'includes')
13 replies
DIAdiscord.js - Imagine an app
Created by Frosty on 7/1/2022 in #djs-questions
TypeError Cannot read properties of undefined (reading 'permissions')
Hello, i have this piece of code and i get this error. Code:
if (message.member.roles.cache.has(modRankRole) || message.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR) || message.author.bot) {
//code
}
if (message.member.roles.cache.has(modRankRole) || message.member.permissions.has(Permissions.FLAGS.ADMINISTRATOR) || message.author.bot) {
//code
}
Error: TypeError: Cannot read properties of undefined (reading 'permissions')
3 replies
DIAdiscord.js - Imagine an app
Created by Frosty on 6/18/2022 in #djs-questions
Error
let cateFive = interaction.guild.channels.cache.find(cat=> cat.name === "meta logs")
let cateFiveID = cateFive.id

interaction.guild.channels.create('🔨meta-logs', {
type: 'GUILD_TEXT',
permissionOverwrites: [{
id: interaction.guild.id,
deny: ['VIEW_CHANNEL'],
}],
parent: cateFiveID
})

let logChannel = interaction.guild.channels.cache.find(channel => channel.name === "🔨meta-logs")
let channel = logChannel.id
let cateFive = interaction.guild.channels.cache.find(cat=> cat.name === "meta logs")
let cateFiveID = cateFive.id

interaction.guild.channels.create('🔨meta-logs', {
type: 'GUILD_TEXT',
permissionOverwrites: [{
id: interaction.guild.id,
deny: ['VIEW_CHANNEL'],
}],
parent: cateFiveID
})

let logChannel = interaction.guild.channels.cache.find(channel => channel.name === "🔨meta-logs")
let channel = logChannel.id
I get a error TypeError: Cannot read properties of undefined (reading 'id')
52 replies
DIAdiscord.js - Imagine an app
Created by Frosty on 6/18/2022 in #djs-questions
How do delete interaction message?
Hello. I have a command that when you run it, it will send a message with 2 buttons. When you press 1st button it will edit the message that works fine, but when you press the second button, it should delete the message & then send a new ephemeral message. I use interaction.message.delete() but i get a error: TypeError: Cannot read properties of undefined (reading 'delete')
41 replies
DIAdiscord.js - Imagine an app
Created by Frosty on 6/17/2022 in #djs-questions
Issue with reaction role with buttons.
Hello, i have my reaction button role system. Whenever i press gray to get the gray color role, it should remove the aqua role if user has it. So when i tested it, it gives the gray role but doesn't remove the aqua role that i also have. Code: https://sourceb.in/OIix4x0cPY I didn't get any errors.
13 replies