crimsonn
crimsonn
DIAdiscord.js - Imagine an app
Created by crimsonn on 9/25/2023 in #djs-questions
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);
});
12 replies