const { Client, Intents, MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
var sleep = require('sleep');
let botIntents = new Intents();
botIntents.add(Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, Intents.FLAGS.DIRECT_MESSAGES)
const client = new Client({ intents: botIntents });
const { token } = require('./config.json');
const guild = client.guilds.cache.get('923910194247892992');
client.once('ready', () => {
console.log("Logged in as " + client.user.tag)
})
client.on('messageCreate' , (msg) => {
if (msg.content.startsWith('ping')) {
const row = new MessageActionRow()
.addComponents(
new MessageButton()
.setCustomId('primary')
.setLabel('Apply')
.setStyle('PRIMARY'),
);
msg.reply({ content: 'Pong!', components: [row] });
}
if (msg.content.startsWith('sc!recruit')) {
for (var member of members) {
msg.channel.send(`\`\`\`${members}\`\`\``)
.then(function (msg) {
msg.react(":thumbsup:")
msg.react(":thumbsdown:")
}).catch(function() {
console.log('error')
});
}
}
client.on('interactionCreate', (interaction) => {
try {
if (!interaction.isButton()) return;
const user = client.users.cache.get(interaction.member.user.id);
user.send("Hello");
interaction.deferUpdate();
} catch (error) {
console.log(error)
}
});
})
client.login(token)```