Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Commit

Permalink
14.0.0
Browse files Browse the repository at this point in the history
everything should be updated to djs v14
  • Loading branch information
mirko93s committed Jul 19, 2022
1 parent 80779fe commit 291ca99
Show file tree
Hide file tree
Showing 41 changed files with 260 additions and 238 deletions.
1 change: 1 addition & 0 deletions chill.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const { Collection, Client, GatewayIntentBits, Partials } = require(`discord.js`);
const client = new Client({
intents: [
GatewayIntentBits.MessageContent,
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildBans,
Expand Down
4 changes: 2 additions & 2 deletions events/guildMemberAdd.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ module.exports = (client, member) => {
if (client.settings.has(member.guild.id, `usercounter`)) client.chill.updateServerStats(client, member); // update server stats counter
// welcome message
const welcomechannel = member.guild.channels.cache.find(c => c.id === (client.settings.get(member.guild.id, `welcomechannel`)));
if (client.settings.get(member.guild.id, `welcomemessage`) === `true` && welcomechannel) {
if (client.settings.get(member.guild.id, `welcomemessage`) && welcomechannel) {
welcomechannel.send({ embeds: [client.chill.welcomeMessage(client, member, member.guild)] }).catch(err => {
return;
});
}
// role on join
const roleonjoin = member.guild.roles.cache.find(r => r.id === client.settings.get(member.guild.id, `roleonjoin`));
if (client.settings.get(member.guild.id, `welcomerole`) === `true` && roleonjoin && !member.guild.features.includes(`MEMBER_VERIFICATION_GATE_ENABLED`)) {
if (client.settings.get(member.guild.id, `welcomerole`) && roleonjoin && !member.guild.features.includes(`MEMBER_VERIFICATION_GATE_ENABLED`)) {
member.roles.add(roleonjoin).catch(err => {
return;
});
Expand Down
2 changes: 1 addition & 1 deletion events/guildMemberRemove.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ module.exports = (client, member) => {
if (client.settings.has(member.guild.id, `xp.${member.id}`)) client.settings.delete(member.guild.id, `xp.${member.id}`);
if (client.settings.has(member.guild.id, `usercounter`)) client.chill.updateServerStats(client, member); // update server stats counter
const welcomechannel = member.guild.channels.cache.find(c => c.id === (client.settings.get(member.guild.id, `welcomechannel`)));
if (client.settings.get(member.guild.id, `welcomemessage`) === `true` && welcomechannel) welcomechannel.send({ embeds: [client.chill.welcomeMessage(client, member, member.guild, false)] });
if (client.settings.get(member.guild.id, `welcomemessage`) && welcomechannel) welcomechannel.send({ embeds: [client.chill.welcomeMessage(client, member, member.guild, false)] });
};
2 changes: 1 addition & 1 deletion events/guildMemberUpdate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ module.exports = (client, oldUser, newUser) => {
// give role on join after rules if guild is a community and has rules verification enabled
if (newUser.guild.features.includes(`MEMBER_VERIFICATION_GATE_ENABLED`) && oldUser.pending === true && newUser.pending === false) {
const roleonjoin = newUser.guild.roles.cache.find(r => r.id === client.settings.get(newUser.guild.id, `roleonjoin`));
if (client.settings.get(newUser.guild.id, `welcomerole`) === `true` && roleonjoin) {
if (client.settings.get(newUser.guild.id, `welcomerole`) && roleonjoin) {
newUser.roles.add(roleonjoin).catch(err => {
return;
});
Expand Down
4 changes: 2 additions & 2 deletions events/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = async (client, msg) => {
// mention bot
if (msg.mentions.has(client.user) && !msg.content.includes(`@here`) && !msg.content.includes(`@everyone`)) msg.reply(LANG.bot_mention(msg.author));
// xp
if (client.settings.get(msg.guild.id, `xpmodule`) === `true` && msg.guild && !msg.content.startsWith(prefix) && !talkedRecently.has(msg.author.id) && msg.channel.id !== client.settings.get(msg.guild.id, `musictextchannel`)) {
if (client.settings.get(msg.guild.id, `xpmodule`) && msg.guild && !msg.content.startsWith(prefix) && !talkedRecently.has(msg.author.id) && msg.channel.id !== client.settings.get(msg.guild.id, `musictextchannel`)) {
client.chill.xpAdd(client, msg, talkedRecently);
}
// old main
Expand All @@ -24,7 +24,7 @@ module.exports = async (client, msg) => {
if (command) {
client.cmdstats.inc(`usage`, command.name);
if (client.settings.includes(msg.guild.id, command.name, `disabledcommands`)) return msg.channel.send({ embeds: [client.chill.error(LANG.guild_disabled(command))] }).then(m => setTimeout(() => m.delete(), 5000)); // check if command is disabled on the guild
if (client.settings.get(msg.guild.id, `autodeletecmds`) === `true`) msg.delete();
if (client.settings.get(msg.guild.id, `autodeletecmds`)) msg.delete();
command.run(client, msg, arg);
} else { // custom command loader
client.chill.checkCustomCommand(client, msg, cmd);
Expand Down
2 changes: 1 addition & 1 deletion functions/checkCustomCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Discord = require(`discord.js`);
*/
module.exports = function(client, msg, cmd) {
if (client.settings.has(msg.guild.id, `customcmd.${cmd}`)) {
if (client.settings.get(msg.guild.id, `autodeletecmds`) === `true`) msg.delete();
if (client.settings.get(msg.guild.id, `autodeletecmds`)) msg.delete();
const customEmbed = new Discord.EmbedBuilder()
.setColor(`Random`)
.setDescription(client.settings.get(msg.guild.id, `customcmd.${cmd}`));
Expand Down
2 changes: 1 addition & 1 deletion functions/ensureGuildSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module.exports = function(client, guild) {
// other
prefix: `.`,
xpcooldown: 5,
lang: `en_US`,
lang: `en-US`,
// array & objects
autovocalchannels: [],
autovocalcloned: [],
Expand Down
47 changes: 25 additions & 22 deletions functions/setupGuildOnJoin.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,80 +3,83 @@
* @param {Object} guild @requires
* @description creates deafult channels, roles, etc on guild join
*/

const { ChannelType } = require(`discord.js`);

module.exports = async function(client, guild) {

if (!guild.members.me.permissions.toArray().includes(`ADMINISTRATOR`)) return;
if (!guild.members.me.permissions.toArray().includes(`MANAGE_ROLES`) && !guild.members.me.permissions.toArray().includes(`MANAGE_CHANNELS`)) return;
if (!guild.members.me.permissions.toArray().includes(`Administrator`)) return;
if (!guild.members.me.permissions.toArray().includes(`ManageRoles`) && !guild.members.me.permissions.toArray().includes(`ManageChannels`)) return;
// roles
await guild.roles.create({ name: `Listening`, permissions: [], color: `CCCC00` })
.then(role => {
client.settings.set(guild.id, role.id, `musictemprole`);
});
guild.roles.create({ name: `DJ`, permissions: [`CONNECT`], color: `D00091` })
guild.roles.create({ name: `DJ`, permissions: [`Connect`], color: `D00091` })
.then(role => {
client.settings.set(guild.id, role.id, `djrole`);
});
guild.roles.create({ name: `Staff`, permissions: [], color: `FC72F3` })
.then(role => {
client.settings.set(guild.id, role.id, `supportrole`);
});
guild.roles.create({ name: `Member`, permissions: [`VIEW_CHANNEL`], color: `33FFFF` })
guild.roles.create({ name: `Member`, permissions: [`ViewChannel`], color: `33FFFF` })
.then(role => {
client.settings.set(guild.id, role.id, `roleonjoin`);
});
// channels
guild.channels.create(`🎫tickets`, { type: `GUILD_CATEGORY` })
guild.channels.create(`🎫tickets`, { type: ChannelType.GuildCategory })
.then(channel => {
client.settings.set(guild.id, channel.id, `ticketcategory`);
});
guild.channels.create(`👋welcome`, { type: `GUILD_TEXT`,
guild.channels.create(`👋welcome`, { type: ChannelType.GuildText,
permissionOverwrites: [{ id: guild.roles.everyone.id,
deny: [`SEND_MESSAGES`, `SEND_TTS_MESSAGES`, `EMBED_LINKS`, `ATTACH_FILES`] }] })
deny: [`SendMessages`, `SendTTSMessages`, `EmbedLinks`, `AttachFiles`] }] })
.then(channel => {
client.settings.set(guild.id, channel.id, `welcomechannel`);
});
guild.channels.create(`📢announcements`, { type: `GUILD_TEXT`,
guild.channels.create(`📢announcements`, { type: ChannelType.GuildText,
permissionOverwrites: [{ id: guild.roles.everyone.id,
deny: [`SEND_MESSAGES`, `SEND_TTS_MESSAGES`, `EMBED_LINKS`, `ATTACH_FILES`] }] })
deny: [`SendMessages`, `SendTTSMessages`, `EmbedLinks`, `AttachFiles`] }] })
.then(channel => {
client.settings.set(guild.id, channel.id, `bcchannel`);
});
guild.channels.create(`🔨punishments`, { type: `GUILD_TEXT`,
guild.channels.create(`🔨punishments`, { type: ChannelType.GuildText,
permissionOverwrites: [{ id: guild.roles.everyone.id,
deny: [`SEND_MESSAGES`, `SEND_TTS_MESSAGES`, `EMBED_LINKS`, `ATTACH_FILES`] }] })
deny: [`SendMessages`, `SendTTSMessages`, `EmbedLinks`, `AttachFiles`] }] })
.then(channel => {
client.settings.set(guild.id, channel.id, `puchannel`);
});
guild.channels.create(`🚨reports`, { type: `GUILD_TEXT`,
guild.channels.create(`🚨reports`, { type: ChannelType.GuildText,
permissionOverwrites: [{ id: guild.roles.everyone.id,
deny: [`VIEW_CHANNEL`] }] })
deny: [`ViewChannel`] }] })
.then(channel => {
client.settings.set(guild.id, channel.id, `reportchannel`);
});
guild.channels.create(`🎉giveaway`, { type: `GUILD_TEXT`,
guild.channels.create(`🎉giveaway`, { type: ChannelType.GuildText,
permissionOverwrites: [{ id: guild.roles.everyone.id,
deny: [`SEND_MESSAGES`, `SEND_TTS_MESSAGES`, `EMBED_LINKS`, `ATTACH_FILES`] }] })
deny: [`SendMessages`, `SendTTSMessages`, `EmbedLinks`, `AttachFiles`] }] })
.then(channel => {
client.settings.set(guild.id, channel.id, `gachannel`);
});
guild.channels.create(`💡poll`, { type: `GUILD_TEXT`,
guild.channels.create(`💡poll`, { type: ChannelType.GuildText,
permissionOverwrites: [{ id: guild.roles.everyone.id,
deny: [`SEND_MESSAGES`, `SEND_TTS_MESSAGES`, `EMBED_LINKS`, `ATTACH_FILES`] }] })
deny: [`SendMessages`, `SendTTSMessages`, `EmbedLinks`, `AttachFiles`] }] })
.then(channel => {
client.settings.set(guild.id, channel.id, `pollchannel`);
});
guild.channels.create(`🔊music`, { type: `GUILD_VOICE`,
guild.channels.create(`🔊music`, { type: ChannelType.GuildVoice,
permissionOverwrites: [{ id: guild.roles.everyone.id,
deny: [`SPEAK`] }] })
deny: [`Speak`] }] })
.then(channel => {
client.settings.set(guild.id, channel.id, `musicvocalchannel`);
});
guild.channels.create(`🎵song-request`, { type: `GUILD_TEXT`,
guild.channels.create(`🎵song-request`, { type: ChannelType.GuildText,
permissionOverwrites: [
{ id: guild.id,
deny: [`VIEW_CHANNEL`] },
deny: [`ViewChannel`] },
{ id: client.settings.get(guild.id, `musictemprole`),
allow: [`VIEW_CHANNEL`, `SEND_MESSAGES`] }] })
allow: [`ViewChannel`, `SendMessages`] }] })
.then(channel => {
client.settings.set(guild.id, channel.id, `musictextchannel`);
});
Expand Down
Loading

0 comments on commit 291ca99

Please sign in to comment.