Skip to content

Commit

Permalink
breakpoint time
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Oct 15, 2023
1 parent cef4a26 commit 1dca9bb
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions src/helpers/functions/missing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { existsSync, readdirSync, statSync } from "fs";
import { mkdir } from "fs/promises";
import formatName from "@utility/formatName";
import { Client } from "@client";
import { ChannelType } from "discord.js";
import { ChannelType, VoiceChannel } from "discord.js";
import { join, normalize } from "path";

import os from "os";
Expand Down Expand Up @@ -62,25 +62,38 @@ export const computeAndUpdate = async (
callback: Function,
): Promise<MissingResult> => {
const results = await compute(client, pack, edition, version, callback);
/* if (!client) return results;
if (!client) return results;

console.log("compute results fetched");

const packProgress = (await axios.get(`${client.tokens.apiUrl}settings/channels.pack_progress`))
.data;

console.log(`pack progress fetched successfully: ${JSON.stringify(packProgress)}`);

const channel = client.channels.cache.get(packProgress[results[2].pack][results[2].edition]);
// channel doesn't exist or can't be fetched, return early
if (!channel) return results;

console.log(`channel fetched successfully: ${(channel as VoiceChannel).name}`);

// you can add different patterns depending on the channel type
switch (channel.type) {
case ChannelType.GuildVoice:
const pattern = /[.\d+]+(?!.*[.\d+])/;
if (channel.name.match(pattern)?.[0] == results[2].completion.toString()) break;

console.log(`channel hasn't been updated yet: ${channel.name.match(pattern)?.[0]}`)

const updatedName = channel.name.replace(pattern, results[2].completion.toString());

console.log(`name has been changed to ${updatedName}`);

channel.setName(updatedName).catch(console.error);

console.log("channel name set successfully");
break;
}
*/

return results;
};
Expand Down

0 comments on commit 1dca9bb

Please sign in to comment.