Skip to content

Commit

Permalink
fix oversite
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Jul 31, 2024
1 parent 2e174fc commit b986f98
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 14 deletions.
4 changes: 2 additions & 2 deletions eslint.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import prettier from 'eslint-config-prettier';
import ts from 'typescript-eslint';
import { Guild } from 'discord.js';
import globals from 'globals';

export default [
Expand All @@ -14,7 +13,7 @@ export default [
globals: {
...globals.es2022,
...globals.node,
guild: Guild
guild: 'writable'
}
},
rules: {
Expand Down Expand Up @@ -46,6 +45,7 @@ export default [
'default-case-last': 'warn',
'no-self-compare': 'error',
'no-new-wrappers': 'error',
'no-fallthrough': 'error',
'no-lone-blocks': 'error',
'no-undef-init': 'error',
'no-else-return': 'warn',
Expand Down
1 change: 1 addition & 0 deletions src/commands/automod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export async function execute(interaction: ChatInputCommandInteraction): Promise
});
}
}
break;
}
default: {
await interaction.reply({ content: 'Invalid subcommand Please provide a valid subcommand', ephemeral: true });
Expand Down
18 changes: 12 additions & 6 deletions src/commands/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@ export async function execute(interaction: ChatInputCommandInteraction): Promise
.setTimestamp()
.setColor(0xff8c00)
.setDescription(
`<@${user.id}>\n\nBot: ${user.user.bot}\nID: ${user.id}\n Created: <t:${
user.user.createdTimestamp
}:F> (<t:${user.user.createdTimestamp}:R>)\nJoined: <t:${
user.joinedTimestamp
}:F> (<t:${user.joinedTimestamp}:R>)\nRoles: ${user.roles.cache.map((role) => `<@&${role.id}>`)}`
`<@${user.id}>\n\nBot: ${user.user.bot}\nID: ${user.id}\n Created: <t:${Math.floor(
user.user.createdTimestamp / 1000
)}:F> (<t:${Math.floor(user.user.createdTimestamp / 1000)}:R>)\nJoined: <t:${Math.floor(
(user.joinedTimestamp ?? 0) / 1000
)}:F> (<t:${Math.floor((user.joinedTimestamp ?? 0) / 1000)}:R>)\nRoles: ${user.roles.cache
.map((role) => `<@&${role.id}>`)
.filter((role) => role !== `<@&${interaction.guild?.id}>`)
.join(', ')}`
);
await interaction.reply({
embeds: [embed],
Expand All @@ -84,7 +87,7 @@ export async function execute(interaction: ChatInputCommandInteraction): Promise
],
ephemeral: true
});
await interaction.reply({ content: `<@${user.id}> has been warned`, ephemeral: true });
break;
}
case 'infractions': {
const userInfractions = await getUserInfractions(commandUser.id);
Expand All @@ -102,6 +105,7 @@ export async function execute(interaction: ChatInputCommandInteraction): Promise
.setColor(0xff8c00)
.setTimestamp();
await interaction.reply({ embeds: [embed], ephemeral: true });
break;
}
case 'warn': {
const reason = interaction.options.getString('reason') || 'No reason provided';
Expand All @@ -115,6 +119,7 @@ export async function execute(interaction: ChatInputCommandInteraction): Promise
.log()
.save();
await interaction.reply({ content: `<@${commandUser.id}> has been warned`, ephemeral: true });
break;
}
case 'kick': {
const reason = interaction.options.getString('reason') || 'No reason provided';
Expand All @@ -128,6 +133,7 @@ export async function execute(interaction: ChatInputCommandInteraction): Promise
.log()
.save();
await interaction.reply({ content: `<@${commandUser.id}> has been kicked`, ephemeral: true });
break;
}
default: {
await interaction.reply({ content: 'Invalid subcommand Please provide a valid subcommand', ephemeral: true });
Expand Down
3 changes: 1 addition & 2 deletions src/functions/CheckPermits.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { autoModBypassRole } from '../../config.json';
import { readFileSync, writeFileSync } from 'fs';
import { UserPermit } from '../commands/automod';
import { Client } from 'discord.js';

export default async function CheckPermits(client: Client) {
export default function CheckPermits() {
const permitData = readFileSync('data/permit.json');
if (!permitData) return;
const permit = JSON.parse(permitData.toString());
Expand Down
10 changes: 6 additions & 4 deletions src/functions/Infraction.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ChannelType } from 'discord.js';
import { infractionLogchannel } from '../../config.json';
import { ChannelType } from 'discord.js';
import { model, Schema } from 'mongoose';

export interface InfractionUser {
Expand Down Expand Up @@ -81,9 +81,11 @@ class Infraction {
return this.infraction.automatic;
}
public toString(): string {
return `Infraction: ${this.infraction.reason}\nAutomatic: ${this.infraction.automatic ? 'Yes' : 'No'}\nUser: <@${
this.infraction.user.id
}>\nStaff: ${this.infraction.staff ? `<@${this.infraction.staff.id}>` : 'None'}`;
return `Infraction: ${this.infraction.reason}\nType: ${this.infraction.type}\nAutomatic: ${
this.infraction.automatic ? 'Yes' : 'No'
}\nUser: <@${this.infraction.user.id}>\nStaff: ${
this.infraction.staff ? `<@${this.infraction.staff.id}>` : 'None'
}`;
}
public log(): this {
const channel = guild.channels.cache.get(infractionLogchannel);
Expand Down

0 comments on commit b986f98

Please sign in to comment.