mirror of
https://github.com/veganhacktivists/arabot.git
synced 2025-05-18 18:04:13 +02:00
docs(database): add JSDoc for ban functions
This commit is contained in:
parent
d42cc6be0b
commit
29df8bf2c4
@ -1,5 +1,11 @@
|
||||
import { container } from '@sapphire/framework';
|
||||
|
||||
/**
|
||||
* Add an entry to the database to log a ban for a user
|
||||
* @param {string} userId Snowflake for the User to ban
|
||||
* @param {string} modId Snowflake for the Moderator who is banning the user
|
||||
* @param {string} reason Reason for banning the user
|
||||
*/
|
||||
export async function addBan(userId: string, modId: string, reason: string) {
|
||||
// Add the user to the database
|
||||
await container.database.ban.create({
|
||||
@ -19,6 +25,11 @@ export async function addBan(userId: string, modId: string, reason: string) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Deactivates the ban on the database for the user
|
||||
* @param {string} userId Snowflake for the User to unban
|
||||
* @param {string} modId Snowflake for the Moderator who is unbanning the user
|
||||
*/
|
||||
export async function removeBan(userId: string, modId: string) {
|
||||
const ban = await container.database.ban.findFirst({
|
||||
where: {
|
||||
@ -46,6 +57,11 @@ export async function removeBan(userId: string, modId: string) {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the user is banned on the database
|
||||
* @param userId Snowflake of the User to check the ban on
|
||||
* @return {boolean} If the ban is active on the database
|
||||
*/
|
||||
export async function checkBan(userId: string) {
|
||||
const ban = await container.database.ban.findFirst({
|
||||
where: {
|
||||
@ -63,6 +79,11 @@ export async function checkBan(userId: string) {
|
||||
return ban.active;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the ban reason for a user from the database
|
||||
* @param {string} userId Snowflake for the User
|
||||
* @return {string} User's reason for being banned
|
||||
*/
|
||||
export async function getBanReason(userId: string) {
|
||||
const ban = await container.database.ban.findFirst({
|
||||
where: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user