Skip to content

Commit

Permalink
Major Updates - 3.5.8
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximKing1 committed Oct 22, 2024
1 parent 917643d commit 93988f8
Show file tree
Hide file tree
Showing 14 changed files with 3,001 additions and 2,315 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const client = new Client({
const { WebhooksManager } = require("blwebhooks");

const voteClient = new WebhooksManager(client, 80, {
database: "none", // mongoose or sqlite
database: "none", // mongoose or sqlite3

protocol: "discordjs", // Define the discord client

Expand Down Expand Up @@ -134,7 +134,7 @@ bot.on("ready", () => {
const { WebhooksManager } = require("blwebhooks");

const voteClient = new WebhooksManager(bot, 80, {
database: "none", // mongoose or sqlite
database: "none", // mongoose or sqlite3

protocol: "eris", // Define the discord client

Expand Down Expand Up @@ -364,10 +364,10 @@ The vote Database feature will save the total votes a User had made for your bot
voteClient.setStroage(DB, String);

// MongooseDB Example (recommended)
voteClient.setStroage("mongo", "mongodb://localhost/my_database");
voteClient.setStroage("mongoose", "mongodb://localhost/my_database");

// SQLITE Example
voteClient.setStroage("sqlite");
voteClient.setStroage("sqlite3");
```

**Pulling User Votes**
Expand Down
186 changes: 105 additions & 81 deletions dist/Client.d.ts
Original file line number Diff line number Diff line change
@@ -1,114 +1,94 @@
/// <reference types="node" />
import { EventEmitter } from "events";
import { EventEmitter } from 'events';
import mongoose from 'mongoose';
export interface WebhooksManager extends EventEmitter {
client: any;
port: any;
port: number;
options: {
/**
* @param protocol The client either 'discordjs' or 'eris'
*/
protocol: string;
* The client protocol, either 'discordjs' or 'eris'
*/
protocol: 'discordjs' | 'eris';
/**
* @param database Either 'mongoose' or 'sqlite3'
*/
database: string;
* The database type, either 'mongoose' or 'sqlite3'
*/
database: 'mongoose' | 'sqlite3' | 'none';
/**
* @param string THe MongoDB connection string
*/
string(string: any, arg1: {
useNewUrlParser: boolean;
useUnifiedTopology: boolean;
useFindAndModify: boolean;
useCreateIndex: boolean;
}): unknown;
storage: null;
extraLogging: boolean;
extra: {
* The MongoDB connection string
*/
connectionString: string;
extra: null | {
extraProtection: boolean;
proxyTrust: boolean;
shardedClient: boolean;
};
extraLogging: boolean;
};
db: any;
db: mongoose.Connection | any;
ready: boolean;
}
/**
* The Webhook Manager Class for configuration
* ```js
* @example
* ```js
* import { WebhooksManager } from "blwebhooks";
*
* const manager = WebhooksManager(client, {
* const manager = new WebhooksManager(client, PORT, {
* database: "mongoose", // mongoose or sqlite
* port: "80",
* storage: {
* protocol: 'discordjs',
* extra: {
* proxyTrust: true, // Use if behind a proxy
* shardedClient: true, // Use if behind a sharded client
* extraProtection: true // Use for the enhanced security features (Will require more RAM)
* extraProtection: true // Use for enhanced security features (Will require more RAM)
* }
* });
*
* client.voteManager = manager;
* client.voteManager = manager; // Attach the manager to the discord client
* ```
*
*
* @param client The client param is the discord.js v14 client instance.
* @param port The port param is used to define the express webserver port.
* @param options The options param is used to define the database options, and other settings.
* @param client - The Discord.js v14 client instance.
* @param options - Configuration options for the WebhooksManager.
* @param options.database - The database type to use ("mongoose" or "sqlite").
* @param options.protocol - The protocol to use ("discordjs" or "eris").
* @param options.port - The port for the Express webserver.
* @param options.extra - Additional storage options.
* @param options.extra.proxyTrust - Set to true if behind a proxy.
* @param options.extra.shardedClient - Set to true if using a sharded client.
* @param options.extra.extraProtection - Enable enhanced security features (requires more RAM).
*
* @since 1.0.3
*/
export declare class WebhooksManager extends EventEmitter {
client: any;
port: any;
port: number;
options: {
/**
* @param protocol The client either 'discordjs' or 'eris'
*/
protocol: string;
* The client protocol, either 'discordjs' or 'eris'
*/
protocol: 'discordjs' | 'eris';
/**
* @param database Either 'mongoose' or 'sqlite3'
*/
database: string;
* The database type, either 'mongoose' or 'sqlite3'
*/
database: 'mongoose' | 'sqlite3' | 'none';
/**
* @param string The MongoDB connection string
*/
string(string: any, arg1: {
useNewUrlParser: boolean;
useUnifiedTopology: boolean;
useFindAndModify: boolean;
useCreateIndex: boolean;
}): unknown;
* The MongoDB connection string
*/
connectionString: string;
/**
* @param storage The storage options can be used to set extraProtection, proxyTrust and shardedClient options.
*
* @example
* ```js
* import { WebhooksManager } from "blwebhooks";
* const manager = WebhooksManager(client, {
* database: "mongoose", // mongoose or sqlite
* port: "80",
* storage: {
* proxyTrust: true, // Use if behind a proxy
* shardedClient: true, // Use if behind a sharded client
* extraProtection: true // Use for the enhanced security features (Will require more RAM)
* }
* });
*
* client.voteManager = manager;
* ```
*
*/
storage: null;
extraLogging: boolean;
extra: {
* Storage options for extra configuration
*/
extra: null | {
extraProtection: boolean;
proxyTrust: boolean;
shardedClient: boolean;
};
/**
* Enable extra logging
*/
extraLogging: boolean;
};
db: any;
db: mongoose.Connection | any;
/**
* @returns
* Indicates whether the manager is ready
*/
ready: boolean;
/**
Expand All @@ -125,23 +105,67 @@ export declare class WebhooksManager extends EventEmitter {
};
}>, init?: boolean);
shardedClient(toggle: boolean): Promise<void>;
/**
* @example
* ```js
* await voteManager.setStroage('mongoose', 'MongooseURL');
* ```
*/
setStroage(DB: string, string: string): Promise<void>;
/**
* @example
* ```js
* await voteManager.setLogging(true);
* ```
*/
setLogging(toggle: boolean): Promise<import("express-serve-static-core").Express | undefined>;
/**
* @example
* ```js
* await voteManager.extraProtection(true);
* ```
*/
extraProtection(toggle: boolean): Promise<import("express-serve-static-core").Express | undefined>;
/**
* @example
* ```js
* await voteManager.proxyTrust(true);
* ```
*/
proxyTrust(toggle: boolean): Promise<void>;
/**
* @example
* ```js
* await voteManager.testVote('userID', 'botID');
* ```
*/
testVote(userID: string, botID: string): Promise<void>;
/**
* @example
* ```js
* const server = await voteManager.getServer('serverID');
* ```
*/
getServer(serverID: string): Promise<any>;
topggVoteHook(url: any, auth: any, toggle: boolean): Promise<void>;
/**
* @example
const client = discord.Client();
const { WebhooksManager } = require("blwebhooks");
const voteClient = new WebhooksManager(client, 80);
client.voteManager = voteClient;
voteClient.IBLVoteHook("IBLHook", "LOADS_OF_RANDOMNESS", true);
*/
* @example
* ```js
* await voteManager.topggVoteHook('url', 'auth', true);
* ```
*/
topggVoteHook(url: string, auth: string, toggle: boolean): Promise<void>;
/**
* @example
* ```js
* const client = discord.Client();
* const { WebhooksManager } = require("blwebhooks");
*
* const voteClient = new WebhooksManager(client, 80);
* client.voteManager = voteClient;
*
* voteClient.IBLVoteHook("IBLHook", "LOADS_OF_RANDOMNESS", true);
* ```
*/
IBLVoteHook(url: any, auth: any, toggle: boolean): Promise<void>;
/**
* @deprecated Legacy API
Expand Down
Loading

0 comments on commit 93988f8

Please sign in to comment.