Eh, ill fix it later

This commit is contained in:
Christopher Cookman 2024-04-10 10:55:16 -06:00
parent 26d4837e0d
commit d80b098d93
Signed by: ChrisChrome
GPG key ID: A023A26E42C33A42

View file

@ -21,7 +21,7 @@ const client = new Discord.Client({
"AutoModerationConfiguration", "AutoModerationConfiguration",
"AutoModerationExecution", "AutoModerationExecution",
"GuildMembers", "GuildMembers",
"GuildModeration", "GuildModeration"
] ]
}); });
@ -163,10 +163,12 @@ function updateStatusMessages() {
}) })
}); });
status_names.forEach((channel) => { status_names.forEach((channel) => {
if (!channel.type == Discord.ChannelType.GuildVoice) return console.log(`${colors.red("[ERROR]")} Channel ${channel.name} is not a voice channel.`); let chan = client.channels.cache.get(channel);
channel.setName(`[ DEFCON ${defcon} ]`).catch((err) => { if (!chan.type == Discord.ChannelType.GuildVoice) return console.log(`${colors.red("[ERROR]")} Channel ${chan.name} is not a voice channel.`);
console.log(`${colors.red("[ERROR]")} Could not set channel name for ${channel.name}.`); console.log(`${colors.green("[INFO]")} Setting channel name for ${chan.name}.`)
}); chan.setName(`[ DEFCON ${defcon} ]`).then(() => {
console.log(`${colors.green("[INFO]")} Successfully set channel name for ${chan.name}.`);
})
}); });
} }
@ -192,7 +194,7 @@ client.on("ready", async () => {
if (msg.change_name) { if (msg.change_name) {
// if name is set, add it to status_names, then skip the rest // if name is set, add it to status_names, then skip the rest
console.log(`${colors.green("[INFO]")} Found channel name change for ${channel.name}.`) console.log(`${colors.green("[INFO]")} Found channel name change for ${channel.name}.`)
return status_names.push(channel); return status_names.push(msg.channel_id);
} }
console.log(`${colors.green("[INFO]")} Found status message for ${channel.name}.`) console.log(`${colors.green("[INFO]")} Found status message for ${channel.name}.`)
// fetch the message id, if it doesnt exist, throw error // fetch the message id, if it doesnt exist, throw error