Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
FirezTheGreat committed Oct 24, 2022
1 parent 84e03b4 commit 4b246af
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 22 deletions.
29 changes: 7 additions & 22 deletions commands/moderation/unban.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module.exports = class Unban extends Command {
client_permissions: [PermissionFlagsBits.BanMembers],
user_permissions: [PermissionFlagsBits.BanMembers],
options: [
{ name: 'id', type: ApplicationCommandOptionType.String, description: 'ID to Unban', required: false },
{ name: 'id', type: ApplicationCommandOptionType.String, description: 'ID to Unban', required: true }
]
});
};
Expand All @@ -24,30 +24,15 @@ module.exports = class Unban extends Command {

async InteractionRun(interaction) {
try {
const users = interaction.options._hoistedOptions.map(({ value }) => value);
const banned_users = [];
const user_id = interaction.options.getString('id');

if (!users.length) return await interaction.reply({ content: '*Please Enter an User ID or User*', ephemeral: true });

await interaction.deferReply();

for (const value of users) {
try {
try {
await interaction.guild.bans.fetch(value);
} catch {
interaction.followUp({ content: `*User ${userMention(value)} is not Banned!*` });
continue;
};
await interaction.guild.bans.remove(value);

banned_users.push(userMention(value));
} catch (error) {
interaction.followUp({ content: `*Couldn\'t Unban User - ${value} from ${interaction.guild.name}!*` });
};
try {
await interaction.guild.bans.remove(user_id);
} catch (error) {
interaction.followUp({ content: `*Couldn\'t Unban User - ${userMention(user_id)} from ${interaction.guild.name}!*` });
};

if (banned_users.length) return await interaction.editReply({ content: `*Unbanned ${banned_users.join(', ')} from ${interaction.guild.name}!*` });
return await interaction.editReply({ content: `*Unbanned ${banned_users.join(', ')} from ${interaction.guild.name}!*` });
} catch (error) {
console.error(error);
return await this.bot.utils.error(interaction, error);
Expand Down
1 change: 1 addition & 0 deletions commands/utility/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module.exports = class Search extends Command {
const channel = interaction.options.getChannel('channel');

let player = await Players.findOne({ id: interaction.member.id });
if (!player) return await interaction.reply({ content: `*You are not registered at ${interaction.guild.name}*`, ephemeral: true });

if (player.pings.ping_interval > Date.now()) {
const time = this.bot.utils.convertMSToDate(player.pings.ping_interval - Date.now());
Expand Down
2 changes: 2 additions & 0 deletions events/client/interactionCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ module.exports = class interactionCreate extends Event {
const category = interaction.guild.channels.cache.get(Categories.TicketId);
const player = await Players.findOne({ id: interaction.member.id });

if (!player) return await interaction.reply({ content: `*You are not registered at ${interaction.guild.name}*`, ephemeral: true });

if (player.tickets.some(({ active }) => active)) return await interaction.editReply({ content: '*You already have an existing ticket.*' });

const ticket = this.bot.utils.generateRandomHex(5);
Expand Down

0 comments on commit 4b246af

Please sign in to comment.