-
-
Notifications
You must be signed in to change notification settings - Fork 6
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
Showing
19 changed files
with
220 additions
and
140 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,10 +1,12 @@ | ||
const xp = require("../lib/xp.js"); | ||
|
||
const MongoURL = "mongodb+srv://test-bot:[email protected]/?retryWrites=true&w=majority"; | ||
|
||
async function test(dbType) { | ||
|
||
switch (dbType) { | ||
case "mongodb": | ||
await xp.connect("mongodb+srv://test-bot:[email protected]/?retryWrites=true&w=majority", { | ||
await xp.connect(MongoURL, { | ||
type: "mongodb", | ||
debug: true | ||
}); | ||
|
@@ -27,16 +29,19 @@ async function test(dbType) { | |
|
||
await xp.create("1234567894", "0987654321", "Snowball"); | ||
|
||
|
||
await xp.setLevel("1234567890", "0987654321", Infinity); | ||
|
||
await xp.setLevel("1234567891", "0987654321", 50); | ||
|
||
await xp.setLevel("1234567893", "0987654321", 420690000); | ||
|
||
await xp.setLevel("1234567892", "0987654321", 100).then(console.log) | ||
await xp.setLevel("1234567892", "0987654321", 0); | ||
|
||
await xp.addXP("1234567892", "0987654321", 650); | ||
|
||
await xp.reset("1234567892", "0987654321").then(console.log); | ||
|
||
await xp.addXP("1234567892", "0987654321", 650).then(console.log) | ||
await xp.fetch("1234567892", "0987654321").then(console.log); | ||
|
||
await xp.rankCard( | ||
{id: "0987654321", name: "SimplyTests"}, | ||
|
Binary file not shown.
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
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 |
---|---|---|
|
@@ -59,30 +59,17 @@ export async function connect(uri: string, options: ConnectionOptions = {type: u | |
|
||
xp.database.exec(`CREATE TABLE IF NOT EXISTS "simply-xps" | ||
( | ||
user | ||
TEXT | ||
UNIQUE, | ||
guild | ||
TEXT, | ||
xp | ||
INTEGER | ||
DEFAULT | ||
0, | ||
level | ||
INTEGER | ||
DEFAULT | ||
0 | ||
user TEXT NOT NULL, | ||
guild TEXT NOT NULL, | ||
name TEXT DEFAULT "Unknown", | ||
level INTEGER DEFAULT 0, | ||
xp INTEGER DEFAULT 0 | ||
)` | ||
); | ||
xp.database.exec(`CREATE TABLE IF NOT EXISTS "simply-xp-levelroles" | ||
( | ||
gid | ||
TEXT | ||
UNIQUE, | ||
lvlrole | ||
TEXT | ||
NOT | ||
NULL | ||
gid TEXT UNIQUE, | ||
lvlrole TEXT NOT NULL | ||
)` | ||
); | ||
} catch (error: unknown) { | ||
|
@@ -140,7 +127,6 @@ export async function checkPackageVersion(type: "mongodb" | "sqlite"): Promise<b | |
try { | ||
const mongoPackage = await import("mongodb/package.json"); | ||
return parseInt(mongoPackage.version.substring(0, 1)) >= 4; | ||
|
||
} catch (_) { | ||
XpLog.info("checkPackageVersion()", "Installing MongoDB [5.x] | Please wait..."); | ||
execSync(`${await getPackageManager()} add [email protected]`); | ||
|
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
Oops, something went wrong.