Meme Bot

I'm making a meme bot for my friend thats essentially a "Messi Bot" and whenever someome says ronaldo w or ronaldow, it times them out for 5m and sends them a message. It wont work (i tested it on my friend with no perms) can someone help? My code:
const { Client, Intents } = require('discord.js');


const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGES,
],
});


const prefix = '!';


client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});


client.on('messageCreate', (message) => {

if (message.author.bot || !message.content.startsWith(prefix)) return;

const content = message.content.slice(prefix.length).toLowerCase();

if (content.includes('ronaldow') || content.includes('ronaldo w')) {

message.member
.timeout({ duration: 300000, reason: 'RonaldoW timeout' })
.then((member) => {

member.send('messi on top');
})
.catch((error) => {
console.error('Error timing out user:', error);
});
}
});


client.login(',ytoken');

const express = require('express');
const app = express();

app.get('/', (req, res) => {
res.send('Bot is online.');
});

const listener = app.listen(process.env.PORT, () => {
console.log('Your app is listening on port ' + listener.address().port);
});
const { Client, Intents } = require('discord.js');


const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.DIRECT_MESSAGES,
],
});


const prefix = '!';


client.once('ready', () => {
console.log(`Logged in as ${client.user.tag}`);
});


client.on('messageCreate', (message) => {

if (message.author.bot || !message.content.startsWith(prefix)) return;

const content = message.content.slice(prefix.length).toLowerCase();

if (content.includes('ronaldow') || content.includes('ronaldo w')) {

message.member
.timeout({ duration: 300000, reason: 'RonaldoW timeout' })
.then((member) => {

member.send('messi on top');
})
.catch((error) => {
console.error('Error timing out user:', error);
});
}
});


client.login(',ytoken');

const express = require('express');
const app = express();

app.get('/', (req, res) => {
res.send('Bot is online.');
});

const listener = app.listen(process.env.PORT, () => {
console.log('Your app is listening on port ' + listener.address().port);
});
7 Replies
d.js toolkit
d.js toolkit15mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
ShompiFlen
ShompiFlen15mo ago
define "wont work" and specify your discord.js version please.
crimsonn
crimsonnOP15mo ago
v13 and when i say it wont work i mean it wont time them out or send them the message
ShompiFlen
ShompiFlen15mo ago
well you are trying to get the content of a message but you are missing the message content intent try fixing that first
crimsonn
crimsonnOP15mo ago
got that
d.js docs
d.js docs15mo ago
method GuildMember#timeout() Times this guild member out.
Danial
Danial15mo ago
^ timeout() doesn't take an object but 2 parameters, time and the reason
Want results from more Discord servers?
Add your server