generated from nhcarrigan/template
feat: require user to be subscribed
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 38s
All checks were successful
Node.js CI / Lint and Test (pull_request) Successful in 38s
This commit is contained in:
parent
88b28364c6
commit
42809c808a
@ -22,6 +22,17 @@ export const translate = async(
|
|||||||
await interaction.deferReply({ flags: [ MessageFlags.Ephemeral ] });
|
await interaction.deferReply({ flags: [ MessageFlags.Ephemeral ] });
|
||||||
const targetLocale = getLocale(interaction);
|
const targetLocale = getLocale(interaction);
|
||||||
|
|
||||||
|
const isEntitled = interaction.entitlements.find((entitlement) => {
|
||||||
|
return entitlement.userId === interaction.user.id && entitlement.isActive();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!isEntitled && interaction.user.id !== "465650873650118659") {
|
||||||
|
await interaction.editReply(
|
||||||
|
"You must be subscribed to translate messages.",
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!supportedLocales.includes(targetLocale)) {
|
if (!supportedLocales.includes(targetLocale)) {
|
||||||
await interaction.editReply("Unsupported locale.");
|
await interaction.editReply("Unsupported locale.");
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user