generated from FnrDev/fnr-template
-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from FnrDev/dev
Dev
- Loading branch information
Showing
6 changed files
with
84 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module.exports = { | ||
name: "blacklist", | ||
description: "Blacklist a user from creating a ticket.", | ||
options: [ | ||
{ | ||
name: "user", | ||
description: "The user to blacklist", | ||
type: 6, | ||
required: true | ||
}, | ||
{ | ||
name: "reason", | ||
description: "The reason of blacklist", | ||
type: 3 | ||
} | ||
], | ||
permission: "ADMINISTATOR", | ||
run: async(interaction, client) => { | ||
const user = interaction.options.getUser('user'); | ||
const reason = interaction.options.getString('reason') || 'No reason provided'; | ||
|
||
// check if user blacklisted | ||
const isBlacklist = await client.db.get('blacklist', user.id); | ||
if (isBlacklist) { | ||
return interaction.reply({ | ||
content: ':x: This user already blacklisted.', | ||
ephemeral: true | ||
}) | ||
} | ||
|
||
await client.db.set('blacklist', user.id, { user: user.id, reason }); | ||
|
||
interaction.reply({ | ||
content: `✅ ${user} (\`${user.id}\`) has been blacklisted.` | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
module.exports = { | ||
name: "unblacklist", | ||
description: "Remove blacklist a user.", | ||
options: [ | ||
{ | ||
name: "user", | ||
description: "The user to unblacklist", | ||
type: 6, | ||
required: true | ||
} | ||
], | ||
permission: "ADMINISTATOR", | ||
run: async(interaction, client) => { | ||
const user = interaction.options.getUser('user'); | ||
|
||
// check if user blacklisted | ||
const isBlacklist = await client.db.get('blacklist', user.id); | ||
if (!isBlacklist) { | ||
return interaction.reply({ | ||
content: ':x: This user is not blacklisted.', | ||
ephemeral: true | ||
}) | ||
} | ||
|
||
await client.db.delete('blacklist', user.id); | ||
|
||
interaction.reply({ | ||
content: `✅ ${user} (\`${user.id}\`) has been unblacklisted.` | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters