Skip to content

Commit

Permalink
quick missing vc fix
Browse files Browse the repository at this point in the history
  • Loading branch information
3vorp committed Dec 22, 2024
1 parent 71a7bd8 commit 883a8a3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/commands/faithful/missing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const command: SlashCommand = {
const version =
edition === "bedrock"
? "latest" // always use latest bedrock version, easier to format
: interaction.options.getString("version") ?? "latest";
: (interaction.options.getString("version") ?? "latest");

const updateChannels = version === "latest";

Expand Down
3 changes: 2 additions & 1 deletion src/helpers/functions/computeMissing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export async function updateVoiceChannel(client: Client, results: MissingData) {
axios.get(`https://api.faithfulpack.net/v2/settings/discord.channels.pack_progress`),
);

if (!packProgress[results.pack] || !packProgress[results.pack][results.edition]) return;
const channel = client.channels.cache.get(packProgress[results.pack][results.edition]);
// channel doesn't exist or can't be fetched, return early
if (!channel) return;
Expand All @@ -162,7 +163,7 @@ export async function updateVoiceChannel(client: Client, results: MissingData) {
switch (channel.type) {
case ChannelType.GuildVoice:
const pattern = /[.\d+]+(?!.*[.\d+])/;
if (channel.name.match(pattern)?.[0] == results.completion.toString()) break;
if (channel.name.match(pattern)?.[0] === results.completion.toString()) break;
const updatedName = channel.name.replace(pattern, results.completion.toString());
channel.setName(updatedName).catch(console.error);
break;
Expand Down

0 comments on commit 883a8a3

Please sign in to comment.