@power-bots/powerbotlibrary 0.0.6 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/main.d.ts +6 -4
- package/dist/main.js +12 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,10 +11,11 @@ npm install @power-bots/powerbotlibrary
|
|
|
11
11
|
|
|
12
12
|
## Usage
|
|
13
13
|
```typescript
|
|
14
|
-
import {
|
|
14
|
+
import { bot } from "@power-bots/powerbotlibrary"
|
|
15
15
|
import { db } from "@power-bots/powerbotlibrary" // If you want to use database
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
bot.setup(__dirname)
|
|
18
|
+
bot.run()
|
|
18
19
|
```
|
|
19
20
|
|
|
20
21
|
More documentation will be available soon.
|
package/dist/main.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { Collection } from 'discord.js';
|
|
2
1
|
export { db } from "./db";
|
|
3
2
|
export declare class Bot {
|
|
4
3
|
log: any;
|
|
5
4
|
client: any;
|
|
6
|
-
commands:
|
|
7
|
-
commandsArray:
|
|
8
|
-
|
|
5
|
+
commands: any;
|
|
6
|
+
commandsArray: any;
|
|
7
|
+
dirname: any;
|
|
8
|
+
setup(dirname: any): void;
|
|
9
|
+
run(): void;
|
|
9
10
|
}
|
|
11
|
+
export declare const bot: Bot;
|
package/dist/main.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.Bot = exports.db = void 0;
|
|
15
|
+
exports.bot = exports.Bot = exports.db = void 0;
|
|
16
16
|
// IMPORTS
|
|
17
17
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
18
18
|
dotenv_1.default.config();
|
|
@@ -24,9 +24,16 @@ const db_1 = require("./db");
|
|
|
24
24
|
var db_2 = require("./db");
|
|
25
25
|
Object.defineProperty(exports, "db", { enumerable: true, get: function () { return db_2.db; } });
|
|
26
26
|
class Bot {
|
|
27
|
-
|
|
27
|
+
setup(dirname) {
|
|
28
|
+
this.dirname = dirname;
|
|
29
|
+
}
|
|
30
|
+
run() {
|
|
28
31
|
this.log = new log_1.Log();
|
|
29
|
-
(
|
|
32
|
+
if (!this.dirname) {
|
|
33
|
+
this.log.error(`Bot was not setup.`);
|
|
34
|
+
process.exit();
|
|
35
|
+
}
|
|
36
|
+
(0, db_1.updateDatabase)(this.dirname);
|
|
30
37
|
this.log.info("Press Control+C to stop the bot");
|
|
31
38
|
// ENVIROMENT VARS
|
|
32
39
|
if (!node_fs_1.default.existsSync(".env")) {
|
|
@@ -49,7 +56,7 @@ class Bot {
|
|
|
49
56
|
// IMPORT COMMANDS
|
|
50
57
|
this.commands = new discord_js_1.Collection();
|
|
51
58
|
this.commandsArray = [];
|
|
52
|
-
const foldersPath = node_path_1.default.join(dirname, 'commands');
|
|
59
|
+
const foldersPath = node_path_1.default.join(this.dirname, 'commands');
|
|
53
60
|
if (node_fs_1.default.existsSync(foldersPath)) {
|
|
54
61
|
const commandFolders = node_fs_1.default.readdirSync(foldersPath);
|
|
55
62
|
for (const folder of commandFolders) {
|
|
@@ -130,3 +137,4 @@ class Bot {
|
|
|
130
137
|
}
|
|
131
138
|
}
|
|
132
139
|
exports.Bot = Bot;
|
|
140
|
+
exports.bot = new Bot();
|