Skip to content

Commit

Permalink
Fix guild create limit, fix emojis and add new cmd
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorKowalczyk committed Apr 12, 2022
1 parent 4acae3d commit 4f1a2e8
Show file tree
Hide file tree
Showing 9 changed files with 211 additions and 99 deletions.
1 change: 1 addition & 0 deletions bot/events/client/ready.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module.exports = async (client) => {
if (client.config.member_limit.respect) {
client.guilds.cache.forEach(async (guild) => {
if (guild.memberCount <= client.config.member_limit.min_members && !client.config.member_limit.ignore.id.includes(guild.id)) {
console.log(chalk.blue.bold(`[${client.user.username.toUpperCase().split(" ")[0]}]`) + chalk.cyan.bold(` Leaving guild (below minimal members) `) + chalk.blue.bold.underline(guild.name) + chalk.cyan.bold(" (ID: ") + chalk.blue.bold.underline(guild.id) + chalk.cyan.bold(")"));
guild.leave();
client.database.query(`DELETE FROM guild_stats WHERE guild_id = '${guild.id}'`);
}
Expand Down
9 changes: 5 additions & 4 deletions bot/events/guild/guildCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ const { MessageEmbed, MessageActionRow, MessageButton } = require("discord.js");
module.exports = async (client, guild) => {
console.log(chalk.bold(chalk.blue.bold(`[${client.user.username.toUpperCase().split(" ")[0]}]`)) + chalk.cyan.bold(` New guild joined: `) + chalk.blue.bold.underline(guild.name) + chalk.cyan.bold(" (ID: ") + chalk.blue.bold.underline(guild.id) + chalk.cyan.bold(") This guild has ") + chalk.blue.bold.underline(guild.memberCount) + chalk.cyan.bold(" members!"));
const first_channel = guild.channels.cache.filter((f) => f.type === "GUILD_TEXT" && f.permissionsFor(guild.me).has(["SEND_MESSAGES", "VIEW_CHANNEL", "EMBED_LINKS"])).first();
if (guild.members.cache.filter((f) => !f.user.bot).size < client.config.member_limit.min_members && !client.config.member_limit.ignore.id.includes(guild.id)) {
if (guild.members.cache.filter((f) => !f.user.bot).size <= client.config.member_limit.min_members && !client.config.member_limit.ignore.id.includes(guild.id)) {
console.log(chalk.bold(chalk.blue.bold(`[${client.user.username.toUpperCase().split(" ")[0]}]`)) + chalk.cyan.bold(` New guild joined: `) + chalk.blue.bold.underline(guild.name) + chalk.cyan.bold(" (ID: ") + chalk.blue.bold.underline(guild.id) + chalk.cyan.bold(") This guild has ") + chalk.blue.bold.underline(guild.members.cache.filter((f) => !f.user.bot).size) + chalk.cyan.bold(" members!"));
const embed = new MessageEmbed()
.setTitle(`${client.bot_emojis.error} It appears that this guild is not big enough!`)
.setDescription(`It appears **${guild.name}** does not meet our requirments:\n - This guild has less than \`${client.config.min_members}\` members.\nPlease consider inviting more members to this guild!`)
.setDescription(`It appears **${guild.name}** does not meet our requirments:\n - This guild has less than \`${client.config.member_limit.min_members}\` members.\nPlease consider inviting more members to this guild!`)
.setColor("RED")
.setThumbnail(guild.iconURL())
.setFooter({ text: `${client.user.username} - The best Discord Bot!`, iconURL: client.user.avatarURL() });
Expand All @@ -22,12 +23,12 @@ module.exports = async (client, guild) => {
} else {
const embed = new MessageEmbed()
.setTitle(`${client.bot_emojis.success} Yay!`)
.setDescription(`> Thank you for inviting me to **${guild.name}**!\n\n> I have almost everything - Fun, Memes, Images, Giveaway, Moderation, Anime and NSFW!> If you have any questions, feel free to join our support server!`)
.setDescription(`> Thank you for inviting me to **${guild.name}**!\n\n> I have almost everything - Fun, Memes, Images, Giveaway, Moderation, Anime and NSFW! If you have any questions, feel free to join our support server!`)
.setColor("#5865F2")
.setThumbnail(guild.iconURL())
.setFooter({ text: `${client.user.username} - The best Discord Bot!`, iconURL: client.user.avatarURL() });
const row = new MessageActionRow()
.addComponents(new MessageButton().setURL(`https://discord.com/oauth2/authorize/?permissions=${client.config.permissions}&scope=${client.config.scopes}&client_id=${client.user.id}`).setEmoji(client.bot_emojis.giveaway).setLabel("Invite me!").setStyle("LINK"))
.addComponents(new MessageButton().setURL(`https://discord.com/oauth2/authorize/?permissions=${client.config.permissions}&scope=${client.config.scopes}&client_id=${client.user.id}`).setLabel("Invite me!").setStyle("LINK"))
.addComponents(new MessageButton().setURL(client.config.support_server).setLabel("Support").setStyle("LINK"))
.addComponents(new MessageButton().setURL("https://github.com/igorkowalczyk/majo.exe").setLabel("Source").setStyle("LINK"));
if (process.env.DASHBOARD) {
Expand Down
1 change: 1 addition & 0 deletions bot/events/guild/guildDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ const chalk = require("chalk");

module.exports = async (client, guild) => {
console.log(chalk.bold(chalk.blue.bold(`[${client.user.username.toUpperCase().split(" ")[0]}]`)) + chalk.cyan.bold(` Guild leaved: `) + chalk.blue.bold.underline(guild.name) + chalk.cyan.bold(" (ID: ") + chalk.blue.bold.underline(guild.id) + chalk.cyan.bold(")"));
client.database.query(`DELETE FROM guild_stats WHERE guild_id = '${guild.id}'`);
};
2 changes: 1 addition & 1 deletion bot/slash_commands/General/modules/debug_bandwidth.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = async (client, interaction, args) => {
const input = Math.round(test.inputBytes / 1024 / 1024 / 1024);
const output = Math.round(test.outputBytes / 1024 / 1024 / 1024);
const embed = new MessageEmbed()
.setTitle(`${client.bot_emojis.connection_good} Debug bandwith`)
.setTitle(`${client.bot_emojis.status_online} Debug bandwith`)
.setColor("#5865F2")
.setThumbnail(client.user.displayAvatarURL({ dynamic: true, format: "png", size: 2048 }))
.setDescription(`⬇️ In: \`${input}MB/s\` | ⬆️ Out: \`${output}MB/s\`\n\n> Websocket ping: \`${client.ws.ping}ms\``)
Expand Down
88 changes: 85 additions & 3 deletions bot/slash_commands/Moderation/member.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
name: "member",
description: "👋 Modify user on this server",
usage: "/member ban <reason> | /member unban <reason> | /member kick <reason> | /member info <user>",
usage: "/member ban <reason> | /member unban <reason> | /member kick <reason> | /member info <user> | /member avatar <user> | /member banner <user> | /member nickname set <user> <nickname> | /member nickname remove <user>",
category: "Moderation",
container: true,
options: [
Expand Down Expand Up @@ -29,7 +29,7 @@ module.exports = {
},
{
name: "unban",
description: "🔐 Unban user from this server",
description: "🔓 Unban user from this server",
type: 1,
usage: `/member unban <reason>`,
category: "Moderation",
Expand Down Expand Up @@ -73,7 +73,7 @@ module.exports = {
},
{
name: "info",
description: "👋 Check information about user",
description: "📝 Check information about user",
type: 1,
usage: `/member info <user>`,
category: "Moderation",
Expand All @@ -87,6 +87,86 @@ module.exports = {
},
],
},
{
name: "avatar",
description: "🧩 Get user avatar",
type: 1,
usage: `/member avatar <user> [guild_avatar]`,
category: "Moderation",
orgin: "member",
options: [
{
name: "user",
description: "The user which avatar should be shown",
required: true,
type: 6,
},
{
name: "guild_avatar",
description: "Show guild avatar instead of user avatar",
required: false,
type: 5,
},
],
},
{
name: "banner",
description: "🧩 Get user banner",
type: 1,
usage: `/member banner <user>`,
category: "Moderation",
orgin: "member",
options: [
{
name: "user",
description: "The user which banner should be shown",
required: true,
type: 6,
},
],
},
{
name: "nickname",
description: "🏷️ Set/remove nickname for user",
type: 2,
usage: `/member nickname set <user> <nickname> | /member nickname remove <user>`,
category: "Moderation",
orgin: "member",
options: [
{
name: "set",
description: "🏷️ Set nickname for user",
type: 1,
options: [
{
name: "user",
description: "The user which nickname should be set",
required: true,
type: 6,
},
{
name: "nickname",
description: "The nickname which should be set",
required: true,
type: 3,
},
],
},
{
name: "remove",
description: "🏷️ Remove nickname for user",
type: 1,
options: [
{
name: "user",
description: "The user which nickname should be removed",
required: true,
type: 6,
},
],
},
],
},
],
run: async (client, interaction, args) => {
try {
Expand All @@ -98,6 +178,8 @@ module.exports = {
require("./modules/member/kick")(client, interaction, args);
} else if (args[0] == "info") {
require("./modules/member/info")(client, interaction, args);
} else if (args[0] == "avatar") {
require("./modules/member/avatar")(client, interaction, args);
} else {
return client.createSlashError(interaction, `${client.bot_emojis.error} | You need to specify a vaild command!`);
}
Expand Down
35 changes: 35 additions & 0 deletions bot/slash_commands/Moderation/modules/member/avatar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const { MessageEmbed, MessageButton, MessageActionRow } = require("discord.js");

module.exports = async (client, interaction, args) => {
const user = interaction.guild.members.cache.get(args[1]);
if (!user) {
return client.createSlashError(interaction, `${client.bot_emojis.error} | I couldn't find that user!`);
}
const avatar = user.user.displayAvatarURL({
dynamic: true,
format: "png",
size: 4096,
});
const row = new MessageActionRow() // Prettier
.addComponents(
// Prettier
new MessageButton() // Prettier
.setLabel("Avatar Link")
.setStyle("LINK")
.setURL(avatar)
);
const embed = new MessageEmbed() // Prettier
.setColor("#5865f2")
.setDescription(`${user.user.tag}'s Avatar`)
.setImage(avatar)
.setTimestamp()
.setFooter({
text: `Requested by ${interaction.user.username}`,
iconURL: interaction.user.displayAvatarURL({
dynamic: true,
format: "png",
size: 2048,
}),
});
await interaction.followUp({ embeds: [embed], components: [row] });
};
88 changes: 42 additions & 46 deletions config/emojis_config.js
Original file line number Diff line number Diff line change
@@ -1,52 +1,48 @@
module.exports = {
// **The config is still in beta!!!**
// Note: See /utilities/emojis
// You must upload the emojis to the server when the bot is!
success: "<:success:860884617820110909>", // https://cdn.discordapp.com/emojis/860884617820110909.png
error: "<:error:860884617770303519>", // https://cdn.discordapp.com/emojis/860884617770303519.png
giveaway: "<a:giveaway:843845378352873492>", // https://cdn.discordapp.com/emojis/843845378352873492.gif
discord_logo: "<:discord_logo:959148568382439484>", // https://cdn.discordapp.com/emojis/959148568382439484.png
member: "<:members:856161806606401556>", // https://cdn.discordapp.com/emojis/856161806606401556.png
channel: "<:channel:856161806586085376>", // https://cdn.discordapp.com/emojis/856161806586085376.png
role: "<:role:856182143734775808>", // https://cdn.discordapp.com/emojis/856182143734775808.png
stage_channel: "<:stage:856161806048165908>", // https://cdn.discordapp.com/emojis/856161806048165908.png
rules_channel: "<:rules:856166510857814087>", // https://cdn.discordapp.com/emojis/856166510857814087.png
boosts_animated: "<a:boost:854794292190773308>", // https://cdn.discordapp.com/emojis/854794292190773308.gif
discord_badges: "<a:badges_roll:842441895137640478>", // https://cdn.discordapp.com/emojis/842441895137640478.gif
status_online: "<:online:871409206748667904>", // https://cdn.discordapp.com/emojis/871409206748667904.png
status_idle: "<:idle:844882507064410123>", // https://cdn.discordapp.com/emojis/844882507064410123.png
status_dnd: "<:dnd:844882506587176960>", // https://cdn.discordapp.com/emojis/844882506587176960.png
status_offline: "<:offline:844882504502870048>", // https://cdn.discordapp.com/emojis/844882504502870048.png
verified_badge: "<:verified:856161805981712395>", // https://cdn.discordapp.com/emojis/856161805981712395.png
cpu_icon: "<:cpu:856174395436171294>", // https://cdn.discordapp.com/emojis/856174395436171294.png
drive_icon: "<:drive:876545424956198952>", // https://cdn.discordapp.com/emojis/876545424956198952.png
ram_icon: "<:ram:856174395508391986>", // https://cdn.discordapp.com/emojis/856174395508391986.png
discord_partner: "<:discordpartner:856161806446493746>", // https://cdn.discordapp.com/emojis/856161806446493746.png
owner_crown: "<:owner:856161806199947285>", // https://cdn.discordapp.com/emojis/856161806199947285.png
emoji_bar_1: "<:bar:838757737327755335>", // https://cdn.discordapp.com/emojis/838757737327755335.png
emoji_bar_2: "<:bar2:838757737596190782>", // https://cdn.discordapp.com/emojis/838757737596190782.png
bot_badge_small: "<:bot:853219015422246922>", // https://cdn.discordapp.com/emojis/853219015422246922.png
bot_badge_part_1: "<:botpart1:853243093485748254>", // https://cdn.discordapp.com/emojis/853243093485748254.png
bot_badge_part_2: "<:botpart2:853243092597604362>", // https://cdn.discordapp.com/emojis/853243092597604362.png
open_collective_logo: "<:opencollective:876452400171479100>", // https://cdn.discordapp.com/emojis/876452400171479100.png
patreon_logo: "<:patreon:876452398879629322>", // https://cdn.discordapp.com/emojis/876452398879629322.png
kofi_logo: "<:kofi:876452398934155264>", // https://cdn.discordapp.com/emojis/876452398934155264.png
pikachu: "<:what:792081636530978847>", // https://cdn.discordapp.com/emojis/792081636530978847.png
buymeacoffee_logo: "<:buy_me_a_coffe:878937137574211644>", // https://cdn.discordapp.com/emojis/878937137574211644.png
loading: "<a:loading:895227261752582154>", // https://cdn.discordapp.com/emojis/895227261752582154.gif
hypesquad: "<:hypesquad:898956482945617980>", // https://cdn.discordapp.com/emojis/898956482945617980.png
hypesquad_balance: "<:hypesquad_balance:898956482270335106>", // https://cdn.discordapp.com/emojis/898956482270335106.png
hypesquad_bravery: "<:hypesquad_bravery:898956481674756106>", // https://cdn.discordapp.com/emojis/898956481674756106.png
hypesquad_brilliance: "<:brilliance:853245937345888287>", // https://cdn.discordapp.com/emojis/853245937345888287.png
verified_bot_developer: "<:verified_bot_developer:898956482517815306>", // https://cdn.discordapp.com/emojis/898956482517815306.png
early_supporter: "<:discord_early_supporter:898956482136113173>", // https://cdn.discordapp.com/emojis/898956482136113173.png
bug_hunter_1: "<:bug_hunter:898956482580721696>", // https://cdn.discordapp.com/emojis/898956482580721696.png
bug_hunter_2: "<:bug_hunter_2:898956482161278976>", // https://cdn.discordapp.com/emojis/898956482161278976.png
discord_employee: "<:staff:959152617458663465>", // https://cdn.discordapp.com/emojis/898956482102566954.png
slash_commands: "<:slash_commands:927627163144949820>", // https://cdn.discordapp.com/emojis/927627163144949820.png
mention: "<:mention:955194876604084315>", // https://cdn.discordapp.com/emojis/955194876604084315.png
settings: "<:settings:955195385306034237>", // https://cdn.discordapp.com/emojis/955195385306034237.png
connection_good: "<:connection:960591744041381989>", // https://cdn.discordapp.com/emojis/960591744041381989.png
success: "<:majo_yes:963333541112987668>", // https://cdn.discordapp.com/emojis/963333541112987668.png
error: "<:majo_no:963333541226217472>", // https://cdn.discordapp.com/emojis/963333541226217472.png
giveaway: "<a:giveaway:963333542442590268>", // https://cdn.discordapp.com/emojis/963333542442590268.gif
discord_logo: "<:discord_logo:963333540630646804>", // https://cdn.discordapp.com/emojis/963333540630646804.png
member: "<:members:963333541305925692>", // https://cdn.discordapp.com/emojis/963333541305925692.png
channel: "<:channel:963333540244758578>", // https://cdn.discordapp.com/emojis/963333540244758578.png
role: "<:member_role:963333541142339605>", // https://cdn.discordapp.com/emojis/963333541142339605.png
stage_channel: "<:stage_channel:963333542199324692>", // https://cdn.discordapp.com/emojis/963333542199324692.png
rules_channel: "<:rules_channel:963333541561790474>", // https://cdn.discordapp.com/emojis/963333541561790474.png
boosts_animated: "<a:booster:963333480899567646>", // https://cdn.discordapp.com/emojis/963333480899567646.gif
discord_badges: "<a:badges_roll:963333479129550889>", // https://cdn.discordapp.com/emojis/963333479129550889.gif
status_online: "<:status_online:963333541888929842>", // https://cdn.discordapp.com/emojis/963333541888929842.png
status_idle: "<:status_idle:963333541846986782>", // https://cdn.discordapp.com/emojis/963333541846986782.png
status_dnd: "<:status_dnd:963333541813428235>", // https://cdn.discordapp.com/emojis/844882506587176960.png
status_offline: "<:status_invisible:963333542383869952>", // https://cdn.discordapp.com/emojis/963333542383869952.png
cpu_icon: "<:cpu:963333540374781972>", // https://cdn.discordapp.com/emojis/963333540374781972.png
drive_icon: "<:hard_drive:963333540844564540>", // https://cdn.discordapp.com/emojis/963333540844564540.png
ram_icon: "<:ram:963333541616304128>", // https://cdn.discordapp.com/emojis/963333541616304128.png
discord_partner: "<:discord_partner:963333540739694602>", // https://cdn.discordapp.com/emojis/963333540739694602.png
owner_crown: "<:owner:963333541343686696>", // https://cdn.discordapp.com/emojis/856161806199947285.png
emoji_bar_1: "<:bar_02:963333479184076810>", // https://cdn.discordapp.com/emojis/963333479184076810.png
emoji_bar_2: "<:bar_01:963333479322517534>", // https://cdn.discordapp.com/emojis/963333479322517534.png
bot_badge_part_1: "<:bot_badge_02:963333478982754375>", // https://cdn.discordapp.com/emojis/963333478982754375.png
bot_badge_part_2: "<:bot_badge_01:963333479301545984>", // https://cdn.discordapp.com/emojis/963333479301545984.png
open_collective_logo: "<:open_collective:963333541284945930>", // https://cdn.discordapp.com/emojis/963333541284945930.png
patreon_logo: "<:patreon:963333541490466816>", // https://cdn.discordapp.com/emojis/963333541490466816.png
kofi_logo: "<:ko_fi:963333541142351903>", // https://cdn.discordapp.com/emojis/963333541142351903.png
buymeacoffee_logo: "<:buy_me_a_coffe:963333480048128030>", // https://cdn.discordapp.com/emojis/963333480048128030.png
pikachu: "<:pikachu:963333541507264512>", // https://cdn.discordapp.com/emojis/963333541507264512.png
loading: "<a:discord_loading:963333542065090630>", // https://cdn.discordapp.com/emojis/963333542065090630.gif
hypesquad: "<:hypesquad:963333540962009168>", // https://cdn.discordapp.com/emojis/963333540962009168.png
hypesquad_balance: "<:hypesquad_balance:963333540546752544>", // https://cdn.discordapp.com/emojis/963333540546752544.png
hypesquad_bravery: "<:hypesquad_bravery:963333540840353882>", // https://cdn.discordapp.com/emojis/963333540840353882.png
hypesquad_brilliance: "<:hypesquad_brilliance:963333541104586802>", // https://cdn.discordapp.com/emojis/963333541104586802.png
verified_bot_developer: "<:developer:963333540429303828>", // https://cdn.discordapp.com/emojis/963333540429303828.png
early_supporter: "<:early_supporter:963333540844552252>", // https://cdn.discordapp.com/emojis/963333540844552252.png
bug_hunter_1: "<:bug_hunter:963333479452508190>", // https://cdn.discordapp.com/emojis/963333479452508190.png
bug_hunter_2: "<:bug_hunter_gold:963333479578357830>", // https://cdn.discordapp.com/emojis/963333479578357830.png
discord_employee: "<:discord_staff:963333540756455444>", // https://cdn.discordapp.com/emojis/963333540756455444.png
slash_commands: "<:slash_commands:963333541565968384>", // https://cdn.discordapp.com/emojis/963333541565968384.png
mention: "<:mention:963333541259792384>", // https://cdn.discordapp.com/emojis/963333541259792384.png
settings: "<:settings:963333541716963348>", // https://cdn.discordapp.com/emojis/963333541716963348.png

// Utility emojis
picture_frame: "🖼️",
Expand Down
2 changes: 1 addition & 1 deletion config/main_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
use_text_commands: true, // Allow usage of *DEPRECATED* text commands (You have to enable Message intent in Discord Developer Portal)

member_limit: {
respect: true, // Respect guild member limit
respect: false, // Respect guild member limit
min_members: 15, // Minimum guild members to join the bot
ignore: {
// Ignore guilds
Expand Down
Loading

0 comments on commit 4f1a2e8

Please sign in to comment.