JollyJohn
JollyJohn
DIAdiscord.js - Imagine an app
Created by JollyJohn on 9/23/2024 in #djs-questions
guildCreate not firing
const wlSchema = require('../../Schemas/serverwlSchema.js'); module.exports = { name: "guildCreate", async execute(guild, client) { console.log(I have joined a new server: ${guild.name} with the ID of ${guild.id}.) client.channels.cache.get('1287510923657089054').send(I have joined a new server: ${guild.name} with the ID of ${guild.id}.) try { const wlguilds = await wlSchema.find().lean(); const guildids = wlguilds.map(guild => guild.guildId); client.guilds.cache.forEach(async guild => { if (!guildids.includes(guild.id)) { await guild.leave(); } }) } catch (error) { console.error(Error leaving guild ${guild.id}:, error); } } }
15 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 6/25/2024 in #djs-questions
role positions
if (interaction.user.roles.highest.position <= target.roles.highest.position)
if (interaction.user.roles.highest.position <= target.roles.highest.position)
8 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 6/25/2024 in #djs-questions
bannable
if (target.bannable === false) return interaction.reply({ content: `I am unable to ban ${target.username}`, ephemeral: true })
if (target.bannable === false) return interaction.reply({ content: `I am unable to ban ${target.username}`, ephemeral: true })
this line is not working, it is giving back true when its false or i just am just missing what is wrong
6 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 9/7/2023 in #djs-questions
bulk delete
I am using bulk delete and if there only 5 messages in the channel but I try to delete 100 it sends unkown message error as the other 95 messages its trying to delete arnt there as there are only 5 msgs if the user wants it to delete 50 messages for example, but only 25 messages have been sent, itll throw the Unknown Message error another 25 times
3 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 6/1/2023 in #djs-questions
msg not sent to thread
client.on(Events.ThreadCreate, async (thread, newlyCreated) => {
const chl = "1113514934643470456";
if(thread.parentId === chl) {
if (thread.appliedTags.includes('1113573160965656576')) {
thread.send({ content: "yes"})
}
}
})
client.on(Events.ThreadCreate, async (thread, newlyCreated) => {
const chl = "1113514934643470456";
if(thread.parentId === chl) {
if (thread.appliedTags.includes('1113573160965656576')) {
thread.send({ content: "yes"})
}
}
})
the msg isnt being sent to the thread channel
2 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 5/4/2023 in #djs-questions
Autocomplete
17 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 5/3/2023 in #djs-questions
autocomplete
how could i use autocomplete to get videos of a certain youtube channel
3 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 5/3/2023 in #djs-questions
thread create error
2 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 5/2/2023 in #djs-questions
bot doesnt add reaction
async execute(message) {
if (!message.guild) return;
if (message.author.bot) return;
if (message.channel.id === "1079430450830921829") {
try {
message.react(":wave:");
} catch (err) {
return;
}
}
async execute(message) {
if (!message.guild) return;
if (message.author.bot) return;
if (message.channel.id === "1079430450830921829") {
try {
message.react(":wave:");
} catch (err) {
return;
}
}
2 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 4/27/2023 in #djs-questions
does the message create event still trigger when a followed channel publishes something?
^
3 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 4/27/2023 in #djs-questions
bot spams
module.exports = {
name: "messageCreate",
once: false,

async execute(message, client) {
if (message.channel.id !== '1100929475849498665') return;
if (message.channel.id === '1100929475849498665') {
await message.channel.send('@everyone')
}
}
}
module.exports = {
name: "messageCreate",
once: false,

async execute(message, client) {
if (message.channel.id !== '1100929475849498665') return;
if (message.channel.id === '1100929475849498665') {
await message.channel.send('@everyone')
}
}
}
19 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 4/5/2023 in #djs-questions
cooldown
62 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 4/3/2023 in #djs-questions
GuildJoinEvent
I have my bot creating some database schemes when the bot is added to a server and then when it leaves, it will all delete, if the bot is offline when the bot leaves or joins a server, how could I ensure that the guild still gets the schemes and still deletes?
9 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 3/30/2023 in #djs-questions
how could I use autocomplete with mongodb
I got no clue where to start
7 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 3/30/2023 in #djs-questions
threadUpdate
Code:
if (newThread.parentId === '1083539122083352589') {
if (!oldThread.appliedTags.includes('1083616112060661892') && newThread.appliedTags.includes('1083616112060661892')) {
await newThread.send('This thread has been marked as solved.\n The thread will be closed shortly.');
await wait(5000);
await newThread.setArchived(true);
}
}
if (newThread.parentId === '1083539122083352589') {
if (oldThread.archived && !newThread.archived) {
const jsremovetag = newThread.appliedTags.filter(tag => tag !== '1083616112060661892')
await jsremovetag.setAppliedTags(jsremovetag)
await newThread.send('This thread has been opened again. Please make sure you have the correct tags on the post.\n Use </get-help:1084975333968707685> to request a coding helper.');
}
}
if (newThread.parentId === '1083539122083352589') {
if (!oldThread.appliedTags.includes('1083616112060661892') && newThread.appliedTags.includes('1083616112060661892')) {
await newThread.send('This thread has been marked as solved.\n The thread will be closed shortly.');
await wait(5000);
await newThread.setArchived(true);
}
}
if (newThread.parentId === '1083539122083352589') {
if (oldThread.archived && !newThread.archived) {
const jsremovetag = newThread.appliedTags.filter(tag => tag !== '1083616112060661892')
await jsremovetag.setAppliedTags(jsremovetag)
await newThread.send('This thread has been opened again. Please make sure you have the correct tags on the post.\n Use </get-help:1084975333968707685> to request a coding helper.');
}
}
Error:
node:events:491
+ throw er; // Unhandled 'error' event
^

8TypeError: jsremovetag.setAppliedTags is not a function
H at module.exports (/home/node/events/discord/threadUpdate.js:14:33)
( at Client.emit (node:events:513:28)
at module.exports [as THREAD_UPDATE]
node:events:491
+ throw er; // Unhandled 'error' event
^

8TypeError: jsremovetag.setAppliedTags is not a function
H at module.exports (/home/node/events/discord/threadUpdate.js:14:33)
( at Client.emit (node:events:513:28)
at module.exports [as THREAD_UPDATE]
What I Am Trying To Do: I am trying to have the bot remove a certain tag if the post is re-opened.
16 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 3/29/2023 in #djs-questions
how to remove tag from thread?
^
18 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 3/28/2023 in #djs-questions
ThreadUpdate
const inactiveThreads = await threadchl.threads.fetchArchived()
inactiveThreads.threads.forEach(async (thread) => {
if (!thread.archived) {
await thread.send('This thread has been reopened. Please use </get-help:1084975333968707685>')
}
})
const inactiveThreads = await threadchl.threads.fetchArchived()
inactiveThreads.threads.forEach(async (thread) => {
if (!thread.archived) {
await thread.send('This thread has been reopened. Please use </get-help:1084975333968707685>')
}
})
i got this but message dont send if i send a message in a closed post making it active agian, using threadUpdate event. im trying to have it send the message if a closed thread is reopened
8 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 3/27/2023 in #djs-questions
how would i check if a certain post in a forum has a certain label and then close that post if it do
^
20 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 3/22/2023 in #djs-questions
Getting TextInput Value
https://pastebin.com/gcKrBWYA Line 191 and down is where I am having issues, it keeps saying fields is undefined, but I am not sure how I would define it, as if I use interaction it will tell me it has already replied
9 replies
DIAdiscord.js - Imagine an app
Created by JollyJohn on 3/20/2023 in #djs-questions
Collector
collector.on('collect', async i => {
const selected = i.values[0];
await i.update(`You selected ${selected}!`)
if (selected === 'DM') {
await i.editReply({content: 'The prompt has been sent to your DMs. Please continute there.', components: [] })
const DMMsg = await i.user.send('bla').catch(async (err) => { return await i.editReply('I was unable to send you a Direct Message. Please ensure you have your DMs enabled.')})
} else if (selected === 'S') {
await i.editReply('nice work!');
}
});
collector.on('end', collected => {
console.log(`Collected ${collected.size} interactions.`);
});

const DMcollector = DMMsg.createMessageComponentCollector({ componentType: ComponentType.StringSelect, time: 15000 })
collector.on('collect', async i => {
const selected = i.values[0];
await i.update(`You selected ${selected}!`)
if (selected === 'DM') {
await i.editReply({content: 'The prompt has been sent to your DMs. Please continute there.', components: [] })
const DMMsg = await i.user.send('bla').catch(async (err) => { return await i.editReply('I was unable to send you a Direct Message. Please ensure you have your DMs enabled.')})
} else if (selected === 'S') {
await i.editReply('nice work!');
}
});
collector.on('end', collected => {
console.log(`Collected ${collected.size} interactions.`);
});

const DMcollector = DMMsg.createMessageComponentCollector({ componentType: ComponentType.StringSelect, time: 15000 })
11 replies