ignored linting

pull/29/head
TheCodedProf 3 years ago
parent 9f01211535
commit 48865eb771

@ -79,7 +79,7 @@ export async function callback(interaction: CommandInteraction | ButtonInteracti
"Self roles are currently disabled. Please contact a staff member or try again later." "Self roles are currently disabled. Please contact a staff member or try again later."
) )
.setStatus("Danger") .setStatus("Danger")
.setEmoji("GUILD.GREEN") .setEmoji("GUILD.RED")
], ],
ephemeral: true ephemeral: true
}); });
@ -92,7 +92,7 @@ export async function callback(interaction: CommandInteraction | ButtonInteracti
"There are no roles available. Please contact a staff member if you believe this is a mistake." "There are no roles available. Please contact a staff member if you believe this is a mistake."
) )
.setStatus("Danger") .setStatus("Danger")
.setEmoji("GUILD.GREEN") .setEmoji("GUILD.RED")
], ],
ephemeral: true ephemeral: true
}); });

@ -14,7 +14,7 @@ const port = 10000;
const runServer = (client: NucleusClient) => { const runServer = (client: NucleusClient) => {
app.get("/", (_req: express.Request, res: express.Response) => { app.get("/", (_req: express.Request, res: express.Response) => {
res.status(200).send(client.ws.ping); res.status(200).send(client.ws.ping.toString());
}); });
app.post("/verify/:code", jsonParser, async function (req: express.Request, res: express.Response) { app.post("/verify/:code", jsonParser, async function (req: express.Request, res: express.Response) {

@ -93,7 +93,7 @@ const dmcallback = async (interaction: CommandInteraction, firstDescription: str
if (i.isButton()) { if (i.isButton()) {
closed = true; closed = true;
} else { } else {
const response = client.database.premium.removePremium(interaction.user.id, i.values[0]!); const response = await client.database.premium.removePremium(interaction.user.id, i.values[0]!);
console.log(response); console.log(response);
} }
} while (!closed); } while (!closed);
@ -163,9 +163,10 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
const hasPremium = await client.database.premium.hasPremium(interaction.guild!.id); const hasPremium = await client.database.premium.hasPremium(interaction.guild!.id);
let premiumGuild = ""; let premiumGuild = "";
if (hasPremium) { if (hasPremium) {
const gaveUser = await client.users.fetch(hasPremium[1]);
premiumGuild = `**This server has premium! It was ${ premiumGuild = `**This server has premium! It was ${
hasPremium[2] === 3 && hasPremium[3] hasPremium[2] === 3 && hasPremium[3]
? `automatically applied by <@${hasPremium[1]}>` ? `automatically applied by ${gaveUser.username}#${gaveUser.discriminator}`
: `given by <@${hasPremium[1]}>` : `given by <@${hasPremium[1]}>`
}**\n\n`; }**\n\n`;
} }
@ -192,6 +193,9 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
); );
} }
let userPremiumServers;
if ((dbMember?.appliesTo.length ?? 0) > 0) userPremiumServers = "\nIf you want to remove premium from a server, run this command in your DMs with me.";
interaction.editReply({ interaction.editReply({
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
@ -219,7 +223,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
new EmojiEmbed() new EmojiEmbed()
.setTitle("Premium") .setTitle("Premium")
.setDescription( .setDescription(
`You have already activated premium on the maximum amount of servers!` + firstDescription `You have already activated premium on the maximum amount of servers!` + userPremiumServers + firstDescription
) )
.setEmoji("NUCLEUS.PREMIUMACTIVATE") .setEmoji("NUCLEUS.PREMIUMACTIVATE")
.setStatus("Danger") .setStatus("Danger")
@ -232,7 +236,7 @@ const callback = async (interaction: CommandInteraction): Promise<void> => {
embeds: [ embeds: [
new EmojiEmbed() new EmojiEmbed()
.setTitle("Premium") .setTitle("Premium")
.setDescription(`You have activated premium on this server!` + firstDescription) .setDescription(`You have activated premium on this server!` + userPremiumServers + firstDescription)
.setEmoji("NUCLEUS.LOGO") .setEmoji("NUCLEUS.LOGO")
.setStatus("Danger") .setStatus("Danger")
], ],

@ -163,7 +163,7 @@ const editTrack = async (
current = { current = {
name: "", name: "",
retainPrevious: false, retainPrevious: false,
nullable: false, nullable: true,
track: [], track: [],
manageableBy: [] manageableBy: []
}; };
@ -173,6 +173,7 @@ const editTrack = async (
new RoleSelectMenuBuilder().setCustomId("addRole").setPlaceholder("Select a role to add").setDisabled(!isAdmin) new RoleSelectMenuBuilder().setCustomId("addRole").setPlaceholder("Select a role to add").setDisabled(!isAdmin)
); );
let closed = false; let closed = false;
let previousMessage = "";
do { do {
const editableRoles: string[] = current.track const editableRoles: string[] = current.track
.map((r) => { .map((r) => {
@ -224,9 +225,9 @@ const editTrack = async (
new ButtonBuilder() new ButtonBuilder()
.setCustomId("nullable") .setCustomId("nullable")
.setLabel(`Role ${current.nullable ? "Not " : ""}Required`) .setLabel(`Role ${current.nullable ? "Not " : ""}Required`)
.setStyle(current.nullable ? ButtonStyle.Success : ButtonStyle.Danger) .setStyle(current.nullable ? ButtonStyle.Danger : ButtonStyle.Success)
.setEmoji( .setEmoji(
getEmojiByName("CONTROL." + (current.nullable ? "TICK" : "CROSS"), "id") as APIMessageComponentEmoji getEmojiByName("CONTROL." + (current.nullable ? "CROSS" : "TICK"), "id") as APIMessageComponentEmoji
) )
); );
@ -247,7 +248,7 @@ const editTrack = async (
}need a role in this track\n` + }need a role in this track\n` +
`${getEmojiByName("CONTROL." + (current.retainPrevious ? "TICK" : "CROSS"))} Members ${ `${getEmojiByName("CONTROL." + (current.retainPrevious ? "TICK" : "CROSS"))} Members ${
current.retainPrevious ? "" : "don't " current.retainPrevious ? "" : "don't "
}keep all roles below their current highest\n\n` + }keep all roles below their current highest\n\n` + (previousMessage ? previousMessage + "\n\n": "") +
createVerticalTrack( createVerticalTrack(
mapped.map((role) => renderRole(role)), mapped.map((role) => renderRole(role)),
new Array(current.track.length).fill(false), new Array(current.track.length).fill(false),
@ -316,13 +317,20 @@ const editTrack = async (
} }
} }
} else { } else {
out.deferUpdate();
switch (out.customId) { switch (out.customId) {
case "addRole": { case "addRole": {
const role = out.values![0]!; const role = out.values![0]!;
if (!current.track.includes(role)) { const roleObj = roles.get(role)!;
current.track.push(role); if (roleObj.position >= (interaction.member as GuildMember).roles.highest.position){
previousMessage = "You can't add a role that is higher than your highest role.";
} else { } else {
out.reply({ content: "That role is already on this track", ephemeral: true }); if (!current.track.includes(role)) {
current.track.push(role);
await interaction.editReply({ embeds: LoadingEmbed, components: [] });
} else {
previousMessage = "That role is already on this track";
}
} }
break; break;
} }

@ -804,10 +804,10 @@ export class Premium {
return this.premium.updateOne({ user: user }, { $addToSet: { appliesTo: guild } }, { upsert: true }); return this.premium.updateOne({ user: user }, { $addToSet: { appliesTo: guild } }, { upsert: true });
} }
removePremium(user: string, guild: string) { async removePremium(user: string, guild: string) {
// console.log("Premium removePremium"); // console.log("Premium removePremium");
this.cache.set(guild, [false, "", 0, false, new Date(Date.now() + this.cacheTimeout)]); this.cache.set(guild, [false, "", 0, false, new Date(Date.now() + this.cacheTimeout)]);
return this.premium.updateOne({ user: user }, { $pull: { appliesTo: guild } }); return await this.premium.updateOne({ user: user }, { $pull: { appliesTo: guild } });
} }
} }

@ -12,7 +12,7 @@ for (const file of files) {
rsmData = JSON.parse(fs.readFileSync(`${dir}/${file}`, 'utf8')); rsmData = JSON.parse(fs.readFileSync(`${dir}/${file}`, 'utf8'));
} catch { continue } } catch { continue }
if (!rsmData.version || rsmData.version < 3) continue; if (!rsmData.version || rsmData.version < 3) continue;
const nucleusData = await client.database.guilds.read(rsmData.guild_info.id) const nucleusData = await client.database.guilds.readOld(rsmData.guild_info.id)
const rsmToNucleus = { const rsmToNucleus = {
id: rsmData.guild_info.id, id: rsmData.guild_info.id,
version: 1, version: 1,
@ -74,6 +74,6 @@ for (const file of files) {
// console.log(rsmToNucleus) // console.log(rsmToNucleus)
const merged = _.merge(nucleusData, rsmToNucleus); const merged = _.merge(nucleusData, rsmToNucleus);
// console.log(merged) // console.log(merged)
await client.database.guilds.write(merged.id, merged); await client.database.guilds.write(merged.id!, merged);
} }

Loading…
Cancel
Save