make all messages ephemeral
This commit is contained in:
parent
50caecd1aa
commit
8d2f9935cf
25
index.js
25
index.js
|
@ -34,6 +34,8 @@ const client = new Discord.Client({
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.use(express.json());
|
||||||
|
|
||||||
// Vars
|
// Vars
|
||||||
|
|
||||||
var handledTransactions = [];
|
var handledTransactions = [];
|
||||||
|
@ -160,7 +162,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
phone_number = interaction.options.getString("phone_number");
|
phone_number = interaction.options.getString("phone_number");
|
||||||
// Check that phone_number is either a 4 digit number starting with 1, a 7 digit number, a 10 digit number, or an 11 digit number starting with 1
|
// Check that phone_number is either a 4 digit number starting with 1, a 7 digit number, a 10 digit number, or an 11 digit number starting with 1
|
||||||
if (!/^(1\d{3}|\d{7}|\d{10}|1\d{10})$/.test(phone_number)) {
|
if (!/^(1\d{3}|\d{7}|\d{10}|1\d{10})$/.test(phone_number)) {
|
||||||
interaction.reply("Invalid phone number. Please enter one of the following:\n- A 4 digit LiteNet extension.\n- A 7 digit TandmX number\n- An 10 digit US phone number.\n- An 11 digit US phone number");
|
interaction.reply({ephemeral: true, content: "Invalid phone number. Please enter one of the following:\n- A 4 digit LiteNet extension.\n- A 7 digit TandmX number\n- An 10 digit US phone number.\n- An 11 digit US phone number"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// check that the user doesnt have any unverified accounts already (check discord_id and verified)
|
// check that the user doesnt have any unverified accounts already (check discord_id and verified)
|
||||||
|
@ -168,7 +170,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
} else if (row) {
|
} else if (row) {
|
||||||
interaction.reply("You already have an unverified account. Please verify it before creating a new one.");
|
interaction.reply({ephemeral: true, content: "You already have an unverified account. Please verify it before creating a new one."});
|
||||||
} else {
|
} else {
|
||||||
accountNumber = generateAccountNumber();
|
accountNumber = generateAccountNumber();
|
||||||
verification_code = generatePhoneCode();
|
verification_code = generatePhoneCode();
|
||||||
|
@ -202,7 +204,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
interaction.reply("Invalid verification code.");
|
interaction.reply({ephemeral: true, content: "Invalid verification code."});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -218,7 +220,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
interaction.reply("You don't have an unverified account.");
|
interaction.reply({ephemeral: true, content: "You don't have an unverified account."});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -237,7 +239,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
ephemeral: true
|
ephemeral: true
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
interaction.reply("You don't have any active accounts.");
|
interaction.reply({ephemeral: true, content: "You don't have any active accounts."});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -259,7 +261,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
interaction.reply("You don't own that account.");
|
interaction.reply({ephemeral:true, content: "You don't own that account."});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -271,7 +273,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
} else if (row) {
|
} else if (row) {
|
||||||
if (!/^(1\d{3}|\d{7}|\d{10}|1\d{10})$/.test(phone_number)) {
|
if (!/^(1\d{3}|\d{7}|\d{10}|1\d{10})$/.test(phone_number)) {
|
||||||
interaction.reply("Invalid phone number. Please enter one of the following:\n- A 4 digit LiteNet extension.\n- A 7 digit TandmX number\n- An 10 digit US phone number.\n- An 11 digit US phone number");
|
interaction.reply({ephemeral: true, content:"Invalid phone number. Please enter one of the following:\n- A 4 digit LiteNet extension.\n- A 7 digit TandmX number\n- An 10 digit US phone number.\n- An 11 digit US phone number"});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
verification_code = generatePhoneCode();
|
verification_code = generatePhoneCode();
|
||||||
|
@ -287,7 +289,7 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
interaction.reply("You don't own that account.");
|
interaction.reply({content: "You don't own that account.", ephemeral: true});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -295,5 +297,12 @@ client.on("interactionCreate", async (interaction) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
app.post("/api/v1/alert", (req, res) => {
|
||||||
|
console.log(req.body);
|
||||||
|
// send no content response
|
||||||
|
res.sendStatus(204);
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
startTime = new Date();
|
startTime = new Date();
|
||||||
client.login(process.env.DISCORD_TOKEN);
|
client.login(process.env.DISCORD_TOKEN);
|
Loading…
Reference in a new issue