dainis
dainis
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by dainis on 10/30/2024 in #djs-questions
A collector that collects messages from a predetermined channel
const collectorFilter = m => m.content.includes('discord');
const collector = interaction.channel.createMessageCollector({ filter: collectorFilter, time: 15_000 });

collector.on('collect', m => {
console.log(`Collected ${m.content}`);
});

collector.on('end', collected => {
console.log(`Collected ${collected.size} items`);
});
const collectorFilter = m => m.content.includes('discord');
const collector = interaction.channel.createMessageCollector({ filter: collectorFilter, time: 15_000 });

collector.on('collect', m => {
console.log(`Collected ${m.content}`);
});

collector.on('end', collected => {
console.log(`Collected ${collected.size} items`);
});
I used this code as a basis, however I had no idea how to make it work in a specific channel without the need of it being triggered by a slash command (I put it in the events folder aswell). Here's how far i've gone
const { Events } = require("discord.js");

module.exports = {
name: Events.ClientReady,
once: false,
execute(client) {
const channel = client.channels.fetch("1221529963761500160");

const collector = channel.createMessageCollector({
time: 15_000,
});

collector.on("collect", (m) => {
console.log(`Collected ${m.content}`);
});

collector.on("end", (collected) => {
console.log(`Collected ${collected.size} items`);
});
},
};
const { Events } = require("discord.js");

module.exports = {
name: Events.ClientReady,
once: false,
execute(client) {
const channel = client.channels.fetch("1221529963761500160");

const collector = channel.createMessageCollector({
time: 15_000,
});

collector.on("collect", (m) => {
console.log(`Collected ${m.content}`);
});

collector.on("end", (collected) => {
console.log(`Collected ${collected.size} items`);
});
},
};
4 replies
DIAdiscord.js - Imagine an app
Created by dainis on 8/22/2024 in #djs-questions
Can't run the guide lightly modified bot
[WARNING] The command at /home/dainis/bot/commands/utility/info.js is missing a required "data" or "execute" property.
Ready! Logged in as xxxxxxxxxx
[WARNING] The command at /home/dainis/bot/commands/utility/info.js is missing a required "data" or "execute" property.
Ready! Logged in as xxxxxxxxxx
I have no idea what am I supposed to do.
64 replies