-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b52d155
commit 1aca32f
Showing
23 changed files
with
169 additions
and
278 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
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
import prismaClient from "@majoexe/database"; | ||
import { Snowflake } from "discord-api-types/globals"; | ||
|
||
export async function clearWarns(userId: Snowflake, guildId: Snowflake) { | ||
try { | ||
const allWarnings = await prismaClient.guildWarns.deleteMany({ | ||
where: { | ||
guildId, | ||
user: { | ||
discordId: userId, | ||
}, | ||
}, | ||
}); | ||
|
||
return allWarnings?.count || 0; | ||
} catch (error) { | ||
console.error("Failed to clear warns:", error); | ||
throw error; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,20 @@ | ||
import prismaClient from "@majoexe/database"; | ||
import { Snowflake } from "discord-api-types/globals"; | ||
|
||
export async function listWarns(guildId: Snowflake, userId: Snowflake) { | ||
try { | ||
const warnings = await prismaClient.guildWarns.findMany({ | ||
where: { | ||
guildId, | ||
user: { | ||
discordId: userId, | ||
}, | ||
}, | ||
}); | ||
|
||
return warnings; | ||
} catch (error) { | ||
console.error("Failed to list warnings:", error); | ||
throw error; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
import prismaClient, { GuildWarns } from "@majoexe/database"; | ||
import { Snowflake } from "discord-api-types/globals"; | ||
|
||
export async function removeWarn(guildId: Snowflake, userId: Snowflake, warnId: GuildWarns["warnId"]) { | ||
try { | ||
const warning = await prismaClient.guildWarns.findFirst({ | ||
where: { | ||
guildId, | ||
user: { | ||
discordId: userId, | ||
}, | ||
warnId, | ||
}, | ||
}); | ||
|
||
if (!warning) return false; | ||
|
||
await prismaClient.guildWarns.delete({ | ||
where: { | ||
id: warning.id, | ||
}, | ||
}); | ||
|
||
return warning; | ||
} catch (error) { | ||
console.error("Failed to remove warning: ", error); | ||
throw error; | ||
} | ||
} |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
import prismaClient from "@majoexe/database"; | ||
import { Snowflake } from "discord-api-types/globals"; | ||
|
||
export async function checkReputation(userId: Snowflake, guildId: Snowflake) { | ||
try { | ||
const rep = await prismaClient.reputation.findFirst({ | ||
where: { | ||
guildId, | ||
userId, | ||
}, | ||
}); | ||
|
||
if (!rep) return 0; | ||
return rep.reputation || 0; | ||
} catch (error) { | ||
console.error("Failed to check reputation:", error); | ||
throw error; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,19 @@ | ||
import prismaClient from "@majoexe/database"; | ||
import { Snowflake } from "discord-api-types/globals"; | ||
|
||
export async function checkXP(userId: Snowflake, guildId: Snowflake) { | ||
try { | ||
const xp = await prismaClient.guildXp.findFirst({ | ||
where: { | ||
guildId, | ||
userId, | ||
}, | ||
}); | ||
|
||
if (!xp) return 0; | ||
return xp.xp || 0; | ||
} catch (error) { | ||
console.error("Failed to check XP:", error); | ||
throw error; | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.