96 lines
2.9 KiB
Plaintext
96 lines
2.9 KiB
Plaintext
|
let db = await greetDB.findOne({ guild: message.guild.id });
|
||
|
if (!db) {
|
||
|
let db = new greetDB({
|
||
|
guild: message.guild.id,
|
||
|
channel: channel.id,
|
||
|
message: "[member:mention] Welcome to [guild:name]",
|
||
|
});
|
||
|
let m = await message.channel.send(
|
||
|
new discord.MessageEmbed()
|
||
|
.setDescription(`**${message.author.tag}**`)
|
||
|
.addField(
|
||
|
"**<a:tickYes:904267903191351326> Enabled greet messages for this**",
|
||
|
"**channel**"
|
||
|
)
|
||
|
.setThumbnail(client.user.displayAvatarURL())
|
||
|
.setTimestamp()
|
||
|
.setFooter(
|
||
|
`Saturn bot`,
|
||
|
client.user.displayAvatarURL()
|
||
|
)
|
||
|
);
|
||
|
setTimeout(() => {
|
||
|
m.delete().catch(() => {});
|
||
|
}, 300000);
|
||
|
return;
|
||
|
} else {
|
||
|
if (!db.channel) {
|
||
|
greetDB.updateOne({ guild: message.guild.id }, { channel: channel.id })
|
||
|
let m = await message.channel.send(
|
||
|
new discord.MessageEmbed()
|
||
|
.setDescription(`**${message.author.tag}**`)
|
||
|
.addField(
|
||
|
"**<a:tickYes:904267903191351326> Enabled greet messages for this**",
|
||
|
"**channel**"
|
||
|
)
|
||
|
.setThumbnail(client.user.displayAvatarURL())
|
||
|
.setTimestamp()
|
||
|
.setFooter(
|
||
|
`Saturn bot`,
|
||
|
client.user.displayAvatarURL()
|
||
|
)
|
||
|
);
|
||
|
setTimeout(() => {
|
||
|
m.delete().catch(() => {});
|
||
|
}, 300000);
|
||
|
return;
|
||
|
}
|
||
|
if (db.channel === channel.id) {
|
||
|
guildDB.updateOne({ guild: message.guild.id }, { channel: channel.id }, function(err, res) {});
|
||
|
let m = await message.channel.send(
|
||
|
new discord.MessageEmbed()
|
||
|
.setDescription(`**${message.author.tag}**`)
|
||
|
.addField(
|
||
|
"**<:npg_cross:904267907100442636> Disabled greet messages from this**",
|
||
|
"**channel**"
|
||
|
|
||
|
)
|
||
|
.setThumbnail(client.user.displayAvatarURL())
|
||
|
.setTimestamp()
|
||
|
.setFooter(
|
||
|
`Saturn bot`,
|
||
|
client.user.displayAvatarURL()
|
||
|
)
|
||
|
);
|
||
|
setTimeout(() => {
|
||
|
m.delete().catch(() => {});
|
||
|
}, 300000);
|
||
|
return;
|
||
|
}/* else {
|
||
|
db.channel = channel.id;
|
||
|
await db.save();
|
||
|
let m = await message.channel.send(
|
||
|
new discord.MessageEmbed()
|
||
|
.setDescription(`**${message.author.tag}**`)
|
||
|
.addField(
|
||
|
"**<a:tickYes:904267903191351326> Enabled greet messages for this**",
|
||
|
"**channel**"
|
||
|
)
|
||
|
.setThumbnail(client.user.displayAvatarURL())
|
||
|
.setTimestamp()
|
||
|
.setFooter(
|
||
|
`Saturn bot`,
|
||
|
client.user.displayAvatarURL()
|
||
|
)
|
||
|
)};
|
||
|
|
||
|
|
||
|
setTimeout(() => {
|
||
|
m.delete().catch(() => {});
|
||
|
}, 300000);
|
||
|
return;
|
||
|
}
|
||
|
}*/
|
||
|
}
|
||
|
}
|
||
|
}
|