diff --git a/src/commands/economy/lucky-wheel.js b/src/commands/economy/lucky-wheel.js index 5fbe123a..53629650 100644 --- a/src/commands/economy/lucky-wheel.js +++ b/src/commands/economy/lucky-wheel.js @@ -9,9 +9,9 @@ class LuckyWheel extends Command { description: "Spin the lucky wheel and get awesome rewards", options: [ { - name: 'rewards', + name: 'info', type: ApplicationCommandOptionType.Subcommand, - description: 'Get a list with the possible loot of a spin.', + description: 'Get more info about the possible loot or spin prices.', options: [] }, { @@ -22,10 +22,25 @@ class LuckyWheel extends Command { { name: 'amount', type: ApplicationCommandOptionType.Integer, - description: 'How many spins you want to do in 1 command.', + description: 'How many spins you want to do in 1 command. | default: 1.', required: false, min_value: 1, - max_value: 15 + max_value: 25 + } + ] + }, + { + name: 'buy', + type: ApplicationCommandOptionType.Subcommand, + description: 'Buy more spins for the lucky wheel.', + options: [ + { + name: 'amount', + type: ApplicationCommandOptionType.Integer, + description: 'How many spins you want to buy. | default: 1.', + required: false, + min_value: 1, + max_value: 25 } ] } diff --git a/src/commands/misc/info.js b/src/commands/misc/info.js index c5bb216c..0f3b271e 100644 --- a/src/commands/misc/info.js +++ b/src/commands/misc/info.js @@ -20,31 +20,20 @@ class Info extends Command { } async run(interaction, data) { - const usedMemory = process.memoryUsage().heapUsed / 1024 / 1024; + const stats = require("../../assets/stats.json"); - const promises = [ - bot.shard.fetchClientValues('guilds.cache.size'), - bot.shard.broadcastEval(c => c.guilds.cache.reduce((acc, guild) => acc + guild.memberCount, 0)), - ]; - - Promise.all(promises) - .then(results => { - const totalGuilds = results[0].reduce((acc, guildCount) => acc + guildCount, 0); - const totalMembers = results[1].reduce((acc, memberCount) => acc + memberCount, 0); - - const newEmbed = new EmbedBuilder() - .setAuthor({ name: `Bot Statistics`, iconURL: `${bot.user.avatarURL() || bot.config.embed.defaultIcon}` }) - .setColor(bot.config.embed.color) - .setFooter({ text: bot.config.embed.footer }) - .setTimestamp() - .setDescription('**If you like this bot, maybe consider [donating](https://coinzbot.xyz/donate).**') - .addFields( - { name: 'Info', value: `:man_technologist: **Owner:** \`Siebe#0001\`\n:globe_with_meridians: **Website: [coinzbot.xyz](${bot.config.website})**\n:beginner: **Official Server: [discord.gg/asnZQwc6kW](https://discord.gg/asnZQwc6kW)**\n:books: **Library:** \`discord.js${dependencies["discord.js"]}\`\n:star: **Version:** \`${version}\``, inline: true }, - { name: 'Statistics', value: `:video_game: **Commands:** \`${bot.commands.size}\`\n:spider_web: **Shard:** \`${interaction.guild.shardId + 1}/${bot.shard.count}\`\n:white_check_mark: **Uptime:** \`${bot.tools.msToTime(bot.uptime)}\`\n:bust_in_silhouette: **Users:** \`${totalMembers}\`\n:printer: **Servers:** \`${totalGuilds}\``, inline: true }, - { name: 'Disclamer', value: `Icons from the shop are from [icons8](https://icons8.com).`, inline: false } - ) - return interaction.editReply({ embeds: [newEmbed] }); - }).catch(); + const newEmbed = new EmbedBuilder() + .setAuthor({ name: `Bot Statistics`, iconURL: `${bot.user.avatarURL() || bot.config.embed.defaultIcon}` }) + .setColor(bot.config.embed.color) + .setFooter({ text: bot.config.embed.footer }) + .setTimestamp() + .setDescription('**If you like this bot, maybe consider [donating](https://coinzbot.xyz/donate).**') + .addFields( + { name: 'Info', value: `:man_technologist: **Owner:** \`Siebe#0001\`\n:globe_with_meridians: **Website: [coinzbot.xyz](${bot.config.website})**\n:beginner: **Official Server: [discord.gg/asnZQwc6kW](https://discord.gg/asnZQwc6kW)**\n:books: **Library:** \`discord.js${dependencies["discord.js"]}\`\n:star: **Version:** \`${version}\``, inline: true }, + { name: 'Statistics', value: `:video_game: **Commands:** \`${bot.commands.size}\`\n:spider_web: **Shard:** \`${interaction.guild.shardId + 1}/${bot.shard.count}\`\n:white_check_mark: **Uptime:** \`${bot.tools.msToTime(bot.uptime)}\`\n:bust_in_silhouette: **Users:** \`${stats.members}\`\n:printer: **Servers:** \`${stats.guilds}\``, inline: true }, + { name: 'Disclamer', value: `Icons from the shop are from [icons8](https://icons8.com).`, inline: false } + ) + return await interaction.editReply({ embeds: [newEmbed] }); } } diff --git a/src/events/interactionCreate.js b/src/events/interactionCreate.js index 4749e86c..d4c3382a 100644 --- a/src/events/interactionCreate.js +++ b/src/events/interactionCreate.js @@ -16,12 +16,12 @@ module.exports = class extends Event { //If it isn't a command then return if (!cmd) return; - const ban = await this.database.fetchBan(interaction.guild.id, interaction.member.id); - if (ban.guild.isBanned) { - return await interaction.reply({ content: `This server is banned from using Coinz.\n**Reason:** ${ban.guild.reason}\n\nIf you are the owner of the server, please join our [**support server**](https://discord.gg/asnZQwc6kW) if you think this ban was a mistake.`, ephemeral: true }); - } else if (ban.user.isBanned) { - return await interaction.reply({ content: `You are banned from using Coinz.\n**Reason:** ${ban.user.reason}\n\nPlease join our [**support server**](https://discord.gg/asnZQwc6kW) if you think this ban was a mistake.`, ephemeral: true }); - } + // const ban = await this.database.fetchBan(interaction.member.id); + // if (ban.guild.isBanned) { + // return await interaction.reply({ content: `This server is banned from using Coinz.\n**Reason:** ${ban.guild.reason}\n\nIf you are the owner of the server, please join our [**support server**](https://discord.gg/asnZQwc6kW) if you think this ban was a mistake.`, ephemeral: true }); + // } else if (ban.user.isBanned) { + // return await interaction.reply({ content: `You are banned from using Coinz.\n**Reason:** ${ban.user.reason}\n\nPlease join our [**support server**](https://discord.gg/asnZQwc6kW) if you think this ban was a mistake.`, ephemeral: true }); + // } if (await cmd.cool(cmd.info.name, interaction.member, cmd.info.cooldown)) { return await interaction.reply({ content: `:x: You have to wait ${this.tools.msToTime(await this.cooldown.getCooldown(interaction.member.id, cmd.info.name) * 1000)} to use this command again.`, ephemeral: true }); diff --git a/src/events/ready.js b/src/events/ready.js index ecd381ce..e414d5d2 100644 --- a/src/events/ready.js +++ b/src/events/ready.js @@ -31,7 +31,8 @@ module.exports = class extends Event { } }); - await this.application?.commands.set(data); // Used to set slash commands globally [Can take several hours to update.] + // await this.application?.commands.set(data); // Used to set slash commands globally [Can take several hours to update.] + await this.guilds.cache.get(this.config.rootServerId)?.commands.set(data); this.logger.ready(`Shard ${this.shard.ids[0]} loaded.`); } }; \ No newline at end of file diff --git a/src/lib/database.js b/src/lib/database.js index d869538b..150841eb 100644 --- a/src/lib/database.js +++ b/src/lib/database.js @@ -5,8 +5,6 @@ const MemberModel = require("../models/Member"); const CooldownModel = require("../models/Cooldown"); const CompanyModel = require("../models/Company"); const StatsModel = require("../models/Stats"); -const GuildBanModel = require("../models/BannedGuild"); -const UserBanModel = require("../models/BannedUser"); const fetchGuild = async function (guildId) { let obj = await GuildModel.findOne({ id: guildId }); @@ -76,31 +74,6 @@ const fetchStats = async function (id) { } } -const fetchBan = async function (guildId, userId) { - let guildObj = await GuildBanModel.findOne({ id: guildId }); - if (guildObj) { - return { - guild: { - isBanned: true, - reason: guildObj.reason || "No reason was given." - } - }; - } - - let userObj = await UserBanModel.findOne({ id: userId }); - if (userObj) { - return { - guild: { isBanned: false }, - user: { - isBanned: true, - reason: userObj.reason || "No reason was given." - } - }; - } - - return { guild: { isBanned: false }, user: { isBanned: false } }; -} - module.exports = { fetchGuild, fetchMember, @@ -108,6 +81,5 @@ module.exports = { fetchStock, fetchCooldown, fetchCompany, - fetchStats, - fetchBan + fetchStats }; \ No newline at end of file diff --git a/src/models/BannedGuild.js b/src/models/BannedGuild.js deleted file mode 100644 index c2bb89d4..00000000 --- a/src/models/BannedGuild.js +++ /dev/null @@ -1,10 +0,0 @@ -const { Schema, model } = require('mongoose'); - -const BannedGuild = Schema({ - id: { type: String, required: true, index: true, unique: true }, - expire: { type: Number, default: 0 }, - reason: { type: String, default: "No reason was given" }, - moderator: { type: String, default: "" } -}); - -module.exports = model('BannedGuild', BannedGuild, 'banned_guild'); \ No newline at end of file diff --git a/src/models/Guild.js b/src/models/Guild.js index 21712a48..779fe10e 100644 --- a/src/models/Guild.js +++ b/src/models/Guild.js @@ -2,9 +2,14 @@ const { Schema, model } = require('mongoose'); const Guild = Schema({ id: { type: String, required: true, unique: true, index: true }, + premium: { type: Boolean, default: false }, + joinedAt: { type: Date, default: Date.now }, + banned: { type: Boolean, default: false }, + banReason: String, airdropStatus: { type: Boolean, default: false }, airdropChannel: { type: String, default: "" }, - airdropNext: { type: Number, default: 0 } + airdropNext: { type: Number, default: 0 }, + airdropTries: { type: Number, default: 0 } }); module.exports = model('Guild', Guild, 'guilds'); \ No newline at end of file diff --git a/src/models/PremiumGuild.js b/src/models/PremiumGuild.js deleted file mode 100644 index 067b2c32..00000000 --- a/src/models/PremiumGuild.js +++ /dev/null @@ -1,9 +0,0 @@ -const { Schema, model } = require('mongoose'); - -const PremiumGuild = Schema({ - id: { type: String, required: true, index: true, unique: true }, - userId: { type: String, required: true, index: true }, - expire: { type: Number, default: 0 } -}); - -module.exports = model('PremiumGuild', PremiumGuild, 'premium_guild'); \ No newline at end of file diff --git a/src/models/PremiumUser.js b/src/models/PremiumUser.js deleted file mode 100644 index 68b0d981..00000000 --- a/src/models/PremiumUser.js +++ /dev/null @@ -1,8 +0,0 @@ -const { Schema, model } = require('mongoose'); - -const PremiumUser = Schema({ - id: { type: String, required: true, index: true, unique: true }, - expire: { type: Number, default: 0 } -}); - -module.exports = model('PremiumUser', PremiumUser, 'premium_user'); \ No newline at end of file