Skip to content

Commit

Permalink
fix: copy old paths to new paths on file setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jejebecarte committed Apr 12, 2024
1 parent 3f703c5 commit 45933b9
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 15 deletions.
2 changes: 1 addition & 1 deletion scripts/setup-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ oldPaths.forEach((path) => {
if (fs.existsSync(newPath)) {
console.warn(`File '${newPath}' already exists.`);
} else {
fs.copyFileSync(newPath, path, fs.constants.COPYFILE_EXCL);
fs.copyFileSync(path, newPath, fs.constants.COPYFILE_EXCL);
}
});
3 changes: 1 addition & 2 deletions src/@types/Command.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,5 @@ declare interface Command {
type ExecuteCommand = (
bot: import('@classes/Bot').default,
interaction: import('discord.js').ChatInputCommandInteraction,
// TODO: use never[] below and force implementations to define types explicitly (use spread?)
args: any[]
args: unknown[]
) => Promise<void>;
7 changes: 3 additions & 4 deletions src/commands/blacklist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export default {
},
run: async (bot, interaction, args) => {
const type = interaction.options.getSubcommand() as 'add' | 'remove';
const mojangProfile = await fetchMojangProfile(args[0]);
const mojangProfile = await fetchMojangProfile(args[0] as string);
const blacklist = _blacklist as BlacklistEntry[];

if (isFetchError(mojangProfile)) {
Expand All @@ -75,8 +75,8 @@ export default {
}

if (type === 'add') {
const endDate = args[1];
const reason = args[2];
const endDate = args[1] as string;
const reason = args[2] as string;
const embed = new EmbedBuilder()
.setAuthor({
name: 'Blacklist',
Expand Down Expand Up @@ -108,7 +108,6 @@ export default {
messageId: blacklistMessage.id,
});
} else {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const blacklistEntry = blacklist.find((user) => user.uuid === mojangProfile.id)!;
blacklist.splice(blacklist.indexOf(blacklistEntry));

Expand Down
4 changes: 2 additions & 2 deletions src/commands/kick.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export default {
],
},
run: async (bot, interaction, args) => {
const user: string = args[0];
const reason: string = args[1];
const user = args[0] as string;
const reason = args[1] as string;

const embed = new EmbedBuilder();
try {
Expand Down
4 changes: 2 additions & 2 deletions src/commands/toggleMute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ export default {
},
run: async (bot, interaction, args) => {
const type = interaction.options.getSubcommand() as 'mute' | 'unmute';
const user: string = args[0];
const duration: string = args[1];
const user = args[0] as string;
const duration = args[1] as string;

const embed = new EmbedBuilder();
try {
Expand Down
2 changes: 1 addition & 1 deletion src/events/discord/interactionCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default {
return;
}

const args: any[] = [];
const args: unknown[] = [];
interaction.options.data.forEach((option) => {
if (option.value) args.push(option.value);

Expand Down
1 change: 0 additions & 1 deletion src/events/discord/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import emojis from '@util/emojis';
const whitelist = ['ass', 'bitch', 'cock', 'dick', 'fuck'];
const dataset = new DataSet<{ originalWord: string }>()
.addAll(englishDataset)
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
.removePhrasesIf((phrase) => whitelist.includes(phrase.metadata!.originalWord));

const profanityMatcher = new RegExpMatcher({
Expand Down
1 change: 0 additions & 1 deletion src/events/mineflayer/chat/joinRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export default {

const playerProfile = await fetchHypixelPlayerProfile(playerName);
if (!isFetchError(playerProfile)) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const networkLevel = Math.sqrt(2 * playerProfile.networkExp! + 30625) / 50 - 2.5;

if (networkLevel < parseFloat(process.env.MINIMUM_NETWORK_LEVEL)) {
Expand Down
2 changes: 1 addition & 1 deletion src/events/mineflayer/chat/whisper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ export default {
(guildMember) => guildMember.uuid === mojangProfile.id
);

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const gexp = Object.values(member!.expHistory).reduce(
(previous, current) => previous + current
);

bot.executeCommand(
`/w ${playerName} ${target}'s total weekly gexp: ${gexp.toLocaleString()}`
);
Expand Down

0 comments on commit 45933b9

Please sign in to comment.