Untitled
unknown
javascript
2 years ago
3.6 kB
9
Indexable
require('dotenv').config();
const { Client, IntentsBitField } = require('discord.js');
const client = new Client({
intents: [
IntentsBitField.Flags.Guilds,
IntentsBitField.Flags.GuildMembers,
IntentsBitField.Flags.GuildMessages,
IntentsBitField.Flags.MessageContent,
],
});
client.on('ready', () => {
console.log(`✅ ${client.user.tag} is online.`);
});
client.on('messageCreate', async (message) => {
if (message.author.bot) {
return;
}
if (message.content === 'hello') {
message.reply('hello');
}
if (message.content.startsWith('/host')) {
const args = message.content.split(' ');
const link = args[1];
const sender = message.author;
const farmingRole = message.guild.roles.cache.find(role => role.name === 'farming');
const firstChannel = client.channels.cache.get('first_destination_channel_id');
if (firstChannel) {
firstChannel.send(`🌟 ${farmingRole} 🌟\n\n:sparkling_heart: **A NEW FARMING SERVER IS OUT** :sparkling_heart:\n\n:cherry_blossom: *MAKE SURE TO READ FARMING INFO AND THE RULES BEFORE JOINING!* :cherry_blossom:\n*IF YOU NEED HELP JOINING GO TO TUTORIAL*\n\n**HOST:** ${sender}\n**LINK:** ${link}`);
} else {
console.log('First destination channel not found.');
}
setTimeout(() => {
const secondChannel = client.channels.cache.get('second_destination_channel_id');
if (secondChannel) {
secondChannel.send(`🌟 ${farmingRole} 🌟\n\n:sparkling_heart: **A NEW FARMING SERVER IS OUT** :sparkling_heart:\n\n:cherry_blossom: *MAKE SURE TO READ FARMING INFO AND THE RULES BEFORE JOINING!* :cherry_blossom:\n*IF YOU NEED HELP JOINING GO TO TUTORIAL*\n\n**HOST:** ${sender}\n**LINK:** ${link}`);
} else {
console.log('Second destination channel not found.');
}
}, 60000);
return;
}
if (message.channel.id === 'specific_channel_id' && message.content.startsWith('http')) {
const link = message.content;
const sender = message.author;
const farmingRole = message.guild.roles.cache.find(role => role.name === 'farming');
const firstChannel = client.channels.cache.get('first_destination_channel_id');
if (firstChannel) {
firstChannel.send(`🌟 ${farmingRole} 🌟\n\n:sparkling_heart: **A NEW FARMING SERVER IS OUT** :sparkling_heart:\n\n:cherry_blossom: *MAKE SURE TO READ FARMING INFO AND THE RULES BEFORE JOINING!* :cherry_blossom:\n*IF YOU NEED HELP JOINING GO TO TUTORIAL*\n\n**HOST:** ${sender}\n**LINK:** ${link}`);
} else {
console.log('First destination channel not found.');
}
setTimeout(() => {
const secondChannel = client.channels.cache.get('second_destination_channel_id');
if (secondChannel) {
secondChannel.send(`🌟 ${farmingRole} 🌟\n\n:sparkling_heart: **A NEW FARMING SERVER IS OUT** :sparkling_heart:\n\n:cherry_blossom: *MAKE SURE TO READ FARMING INFO AND THE RULES BEFORE JOINING!* :cherry_blossom:\n*IF YOU NEED HELP JOINING GO TO TUTORIAL*\n\n**HOST:** ${sender}\n**LINK:** ${link}`);
} else {
console.log('Second destination channel not found.');
}
}, 60000); // 60 seconds delay
}
});
client.login(process.env.TOKEN);
Editor is loading...
Leave a Comment