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);
});