Squashed Bugs

pull/85/head
TheCodedProf 3 years ago
parent c7e8ef1f92
commit e49649c0e2
No known key found for this signature in database
GPG Key ID: 803E7CCB5577E6A2

@ -7,7 +7,6 @@ import Discord, {
ActionRowBuilder,
ButtonBuilder,
MessageComponentInteraction,
ModalSubmitInteraction,
ButtonStyle,
TextInputStyle,
APIMessageComponentEmoji,
@ -427,13 +426,10 @@ const callback = async (interaction: CommandInteraction): Promise<unknown> => {
}
if (out === null || out.isButton()) {
continue;
} else if (out instanceof ModalSubmitInteraction) {
let toAdd = out.fields.getTextInputValue("note") || null;
if (toAdd === " ") toAdd = null;
if (toAdd) toAdd = toAdd.trim();
await client.database.notes.create(member.guild.id, member.id, toAdd);
} else {
continue;
let toAdd = out.fields.getTextInputValue("note").trim() || null;
if (toAdd === "") toAdd = null;
await client.database.notes.create(member.guild.id, member.id, toAdd);
}
} else if (i.customId === "history") {
await i.deferUpdate();

@ -757,8 +757,9 @@ const mentionMenu = async (
.addComponents(
new ActionRowBuilder<TextInputBuilder>().addComponents(
new TextInputBuilder()
.setLabel("Amount")
.setCustomId("mass")
.setPlaceholder("Amount")
.setPlaceholder(current.mass === 5 ? "Amount" : current.mass.toString())
.setMinLength(1)
.setMaxLength(3)
.setStyle(TextInputStyle.Short)

@ -698,7 +698,10 @@ export class ModNotes {
async create(guild: string, user: string, note: string | null) {
// console.log("ModNotes create");
await this.modNotes.updateOne({ guild: guild, user: user }, { $set: { note: note } }, { upsert: true });
const modNote = await this.modNotes.findOne({ guild: guild, user: user });
modNote
? await this.modNotes.updateOne({ guild: guild, user: user }, { $set: { note: note } }, collectionOptions)
: await this.modNotes.insertOne({ guild: guild, user: user, note: note }, collectionOptions);
}
async read(guild: string, user: string) {

Loading…
Cancel
Save