Feature/ts #42

Merged
Vylpes merged 10 commits from feature/ts into develop 2021-07-24 12:57:28 +01:00
37 changed files with 607 additions and 11860 deletions

13
.env.template Normal file
View file

@ -0,0 +1,13 @@
# Security Warning! Do not commit this file to any VCS!
VylpesTester commented 2021-07-18 19:44:42 +01:00 (Migrated from github.com)
Review

Document this file

Document this file
# This is a local file to speed up development process,
# so you don't have to change your environment variables.
#
# This is not applied to `.env.template`!
# Template files must be committed to the VCS, but must not contain
# any secret values.
BOT_TOKEN=
BOT_PREFIX=v!
FOLDERS_COMMANDS=commands
FOLDERS_EVENTS=events

5
.gitignore vendored
View file

@ -106,13 +106,10 @@ dist
# VylBot-Core Testing Files
commands/
events/
/bot.js
/config.json
/bot.ts
!tests/commands/
!tests/events/
# Linux Environment Files
*.swp
cmdconfig.json

View file

@ -1,4 +1,4 @@
bot.js
config.json
.env
bot.ts
commands/
events/

102
README.md
View file

@ -6,39 +6,99 @@ Discord bot client based upon Discord.js
Download the latest version from the [releases page](https://gitlab.vylpes.com/Vylpes/vylbot-core/-/releases).
Copy the config template file and fill in the strings.
Copy the config template file and fill in the values.
```json
{
"token": "",
"prefix": "",
"commands": [
""
],
"events": [
""
]
}
```env
BOT_TOKEN={TOKEN}
BOT_PREFIX=v!
FOLDERS_COMMANDS=commands
FOLDERS_EVENTS=events
```
* **Token:** Your bot's token
* **Prefix** The command prefix
* **Commands:** An array of the folders which contain your commands
* **Events:** An array of the folders which contain your events
* **BOT_TOKEN:** Your bot's token, replace {TOKEN} with your bot token
* **BOT_PREFIX** The command prefix
* **FOLDERS_COMMANDS:** The folder which contains your commands
* **FOLDERS_EVENTS** The folder which contains your events
Make sure that you **DO NOT** put your .env file into VCS!
## Usage
Implement the client using something like:
```js
const vylbot = require('vylbot-core');
const config = require('config.json');
```ts
// bot.ts
const client = new vylbot.client(config);
import { CoreClient } from "vylbot-core";
const client = new CoreClient();
client.start();
```
See the [docs](https://gitlab.vylpes.com/Vylpes/vylbot-core/-/wikis/home) for more information on how to use vylbot-core
### Writing Commands
The code below will reply to the user with 'PONG' when they type {PREFIX}ping
```ts
// Ping.ts
import { Command, ICommandContext } from "vylbot-core";
export class Ping extends Command {
constructor() {
super();
this._roles = [ "Moderator" ];
this._category = "General";
}
public override execute(context: ICommandContext) {
context.message.reply('PONG');
}
}
```
* **roles**: An array containing what roles the user needs in order to run the command.
* **category**: The category the role is part of, useful for categorising commands together in a help command.
The `context` parameter contains the following:
* **name**: The command name
* **args**: An array of arguments supplied with the command
* **message**: The Discord Message object for the command message sent
### Writing Events
The code below will log to the console 'Member Joined: {USERNAME}' when a member joins a server the bot is in
```ts
// Moderation.ts
import { Event } from "vylbot-core";
import { GuildMember } from "discord.js";
export class Moderation extends Event {
public override guildMemberAdd(member: GuildMember) {
console.log(`Member Joined: ${member.tag}`);
}
}
```
The following events are supported:
* channelCreate(channel: Channel)
* channelDelete(channel: Channel | PartialDMChannel)
* channelUpdate(oldChannel: Channel, newChannel: Channel)
* guildBanAdd(guild: Guild, user: User)
* guildBanRemove(guild: Guild, user: User)
* guildCreate(guild: Guild)
* guildMemberAdd(member: GuildMember)
* guildMemberRemove(member: GuildMember | PartialGuildMember)
* guildMemberUpdate(oldMember: GuildMember | PartialGuildMember, newMember: GuildMember)
* message(message: Message)
* messageDelete(message: Message | PartialMessage)
* messageUpdate(oldMessage: Message | PartialMessage, newMessage: Message | PartialMessage)
* ready()
All parameters are supplied from discord.js
## Contributing

View file

@ -1,3 +0,0 @@
{
}

10819
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,6 +4,7 @@
"description": "A discord client based upon discord.js",
"main": "./src/index",
"scripts": {
"build": "tsc",
"test": "jest --coverage",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
@ -13,7 +14,7 @@
"funding": "https://ko-fi.com/gravitysoftware",
"dependencies": {
"discord.js": "^12.3.1",
"jest": "^26.6.3"
"dotenv": "^10.0.0"
},
"bugs": "https://github.com/vylpes/vylbot-core/issues",
"homepage": "https://github.com/vylpes/vylbot-core",
@ -24,6 +25,7 @@
],
"repository": "github:vylpes/vylbot-core",
"devDependencies": {
"eslint": "^7.17.0"
"@types/node": "^16.3.2",
"typescript": "^4.3.5"
}
}

View file

@ -1,64 +0,0 @@
// Required Components
const { Client } = require('discord.js');
const { validateConfig } = require('./validation');
const events = require('./events');
const util = require('./util');
// Required JSON
const expectedConfig = require('../json/expectedConfig.json');
// Client Class
class client extends Client {
constructor(config, commandConfig) {
// Call Discord.JS Client
super();
// Set the client's configuration, initialise events, initialise utilities
this.config = config;
this.commandConfig = commandConfig;
this.events = new events();
this.util = new util(this);
}
// Method to start the bot
start() {
// Check the bot is ready to start
if (!this._config) throw "Config has not been set";
if (!this._commandConfig) throw "Command Config has not been set";
// Events to handle commands
super.on("message", this.events.message);
super.on("ready", this.events.ready);
// Login to discord using Discord.JS
super.login(this._config.token);
// Load events
this.util.loadEvents();
}
// Config
get config() {
return this._config;
}
set config(config) {
// Validate the config
const val = validateConfig(config, expectedConfig);
if (!val.valid) throw val.message;
this._config = config;
}
// Command Config
get commandConfig() {
return this._commandConfig;
}
set commandConfig(config) {
this._commandConfig = config;
}
}
module.exports = client;

32
src/client/client.ts Normal file
View file

@ -0,0 +1,32 @@
import { Client } from "discord.js";
import * as dotenv from "dotenv";
import { Events } from "./events";
import { Util } from "./util";
export class CoreClient extends Client {
private _events: Events;
private _util: Util;
constructor() {
super();
dotenv.config();
this._events = new Events();
this._util = new Util();
}
public start() {
if (!process.env.BOT_TOKEN) throw "BOT_TOKEN is not defined in .env";
if (!process.env.BOT_PREFIX) throw "BOT_PREFIX is not defined in .env";
if (!process.env.FOLDERS_COMMANDS) throw "FOLDERS_COMMANDS is not defined in .env";
if (!process.env.FOLDERS_EVENTS) throw "FOLDERS_EVENTS is not defined in .env";
super.on("message", this._events.onMessage);
super.on("ready", this._events.onReady);
VylpesTester commented 2021-07-18 19:46:24 +01:00 (Migrated from github.com)
Review

This should also be an event in the event class

This should also be an event in the event class
super.login(process.env.BOT_TOKEN);
this._util.loadEvents(this);
}
}

View file

@ -1,42 +0,0 @@
// Events Class
class event {
// Emit when a message is sent
// Used to check for commands
message(message) {
// Make sure command is sent within a guild and not by a bot, otherwise return and ignore
if (!message) return false;
if (!message.guild) return false;
if (message.author.bot) return false;
// Get the prefix from the config
const prefix = this.config.prefix;
// If the message starts with the prefix, then treat it as a command
if (message.content.substring(0, prefix.length).toLowerCase() == prefix.toLowerCase()) {
// Get the arguments in the message, after the first space (after the command name)
const args = message.content.substring(prefix.length).split(" ");
const name = args.shift();
// Load the command from the util class
const res = this.util.loadCommand(name, args, message);
if (!res.valid) {
if (res.message != 'File does not exist') throw res.message;
}
return {
"prefix": prefix,
"name": name,
"args": args,
"message": message
};
}
}
// Emit when bot is logged in and ready to use
ready() {
console.log("Ready");
}
}
module.exports = event;

80
src/client/events.ts Normal file
View file

@ -0,0 +1,80 @@
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
import { Message } from "discord.js";
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
import { IBaseResponse } from "../contracts/IBaseResponse";
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
import { Util } from "./util";
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
export interface IEventResponse extends IBaseResponse {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
context?: {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
prefix: string;
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
name: string;
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
args: string[];
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
message: Message;
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
export class Events {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
private _util: Util;
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
constructor() {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
this._util = new Util();
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
// Emit when a message is sent
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
// Used to check for commands
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
public onMessage(message: Message): IEventResponse {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
if (!message) return {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
valid: false,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
message: "Message was not supplied.",
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
};
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
if (!message.guild) return {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
valid: false,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
message: "Message was not sent in a guild, ignoring.",
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
};
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
if (message.author.bot) return {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
valid: false,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
message: "Message was sent by a bot, ignoring.",
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
};
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
const prefix = process.env.BOT_PREFIX as string;
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
if (message.content.substring(0, prefix.length).toLowerCase() == prefix.toLowerCase()) {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
const args = message.content.substring(prefix.length).split(" ");
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
const name = args.shift();
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
if (!name) return {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
valid: false,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
message: "Command name was not found",
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
};
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
const res = this._util.loadCommand(name, args, message);
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
if (!res.valid) {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
if (res.message != 'File does not exist') return {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
valid: false,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
message: res.message,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
};
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
return {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
valid: true,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
context: {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
prefix: prefix,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
name: name,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
args: args,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
message: message,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
},
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
};
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
return {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
valid: false,
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
message: "Message was not a command, ignoring.",
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
// Emit when bot is logged in and ready to use
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
public onReady() {
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
console.log("Ready");
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?
}
VylpesTester commented 2021-07-18 19:47:21 +01:00 (Migrated from github.com)
Review

Should be false?

Should be false?

View file

@ -1,123 +0,0 @@
// Required Components
const { readdirSync, existsSync } = require('fs');
function generateResponse(isValid, message) {
return {
"valid": isValid,
"message": message || "No message was given"
}
}
// Util Class
class util {
constructor(client) {
// Set the client
this._client = client;
}
// Load a command and send the arguments with it
loadCommand(name, args, message) {
// Get the current folder to check
const folder = this._client.config.commands;
// If the folder exists
if (existsSync(`${process.cwd()}/${folder}/`)) {
// If the file exists inside the folder
if (existsSync(`${process.cwd()}/${folder}/${name}.js`)) {
// Require the command file, now that we know it exists and initialise it
const commandFile = require(`${process.cwd()}/${folder}/${name}.js`);
const command = new commandFile();
// Require the command config file and get the config for the current command
const configJson = this._client.commandConfig;
const config = configJson[name];
// Get the list of required configurations the command needs
const commandConfigs = command.configs;
// Loop through all the required configs of the command
for (const i in commandConfigs) {
// If the command doesn't have the configs in the config string, throw an error
if (!config) return generateResponse(false, `${commandFile.name} requires ${commandConfigs[i]} in it's configuration`);
if (!config[commandConfigs[i]]) return generateResponse(false, `${commandFile.name} requires ${commandConfigs[i]} in it's configuration`);
}
// Get the roles required for this command to run
const requiredRoles = command.roles;
// Get the category, if there is no category, set it to a default string
if (!command.category) command.category = "none";
// Loop through all roles required
for (const i in requiredRoles) {
// If the user doesn't have a required role, don't run the command and let the user know
if (!message.member.roles.cache.find(role => role.name == requiredRoles[i])) {
message.reply(`You require the \`${requiredRoles[i]}\` role to run this command`);
return generateResponse(false, `You require the \`${requiredRoles[i]}\` role to run this command`);
}
}
// Get the ids of the users that are only permitted to run this command
const users = command.users;
// If the command has any limits, limit the command, otherwise default to anyone
if (users.length > 0) {
if (!users.includes(message.member.id)) {
message.reply(`You do not have permission to run this command`);
return generateResponse(false, "You do not have permission to run this command");
}
}
// Run the command and pass the command context with it
command[command.run]({
"command": name,
"arguments": args,
"client": this._client,
"message": message,
"config": config,
"commandConfigs": commandConfigs
});
return generateResponse(true, `loaded command '${name}' with arguments '${args}'`);
} else {
return generateResponse(false, 'File does not exist');
}
} else {
return generateResponse(false, 'Command folder does not exist');
}
}
// Load the events
loadEvents() {
// Get the current folder to check
const folder = this._client.config.events;
// If the folder exists
if (existsSync(`${process.cwd()}/${folder}/`)) {
// Get the files inside of this folder
const eventFiles = readdirSync(`${process.cwd()}/${folder}/`);
// Loop through all the files in the folder
for (let i = 0; i < eventFiles.length; i++) {
// Ignore non-javascript files
if (eventFiles[i].includes('.js')) {
// Get the event name, by taking the command file and removing the ".js" from the end
const eventName = eventFiles[i].split('.')[0];
// Get the file of the event
const file = require(`${process.cwd()}/${folder}/${eventName}.js`);
// Initialise the event class
const event = new file;
// Set the client to emit to this event
this._client.on(eventName, event[event.run]);
}
}
} else {
return generateResponse(false, 'Event folder does not exist');
}
}
}
module.exports = util;

120
src/client/util.ts Normal file
View file

@ -0,0 +1,120 @@
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Required Components
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
import { Client, Message } from "discord.js";
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
import { readdirSync, existsSync } from "fs";
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
import { IBaseResponse } from "../contracts/IBaseResponse";
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
import { Command } from "../type/command";
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
import { Event } from "../type/event";
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
import { ICommandContext } from "../contracts/ICommandContext";
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
export interface IUtilResponse extends IBaseResponse {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
context?: {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
name: string;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
args: string[];
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message: Message;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Util Class
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
export class Util {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
public loadCommand(name: string, args: string[], message: Message): IUtilResponse {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (!message.member) return {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
valid: false,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message: "Member is not part of message",
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
};
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const folder = process.env.FOLDERS_COMMANDS;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (existsSync(`${process.cwd()}/${folder}/`)) {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (existsSync(`${process.cwd()}/${folder}/${name}.ts`)) {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const commandFile = require(`${process.cwd()}/${folder}/${name}.ts`);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const command = new commandFile[name]() as Command;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const requiredRoles = command._roles;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (!command._category) command._category = "none";
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
for (const i in requiredRoles) {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (!message.member.roles.cache.find(role => role.name == requiredRoles[i])) {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message.reply(`You require the \`${requiredRoles[i]}\` role to run this command`);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
return {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
valid: false,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message: `You require the \`${requiredRoles[i]}\` role to run this command`,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
};
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const context: ICommandContext = {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
name: name,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
args: args,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message: message,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Run the command and pass the command context with it
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
command.execute(context);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
return {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
valid: true,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
context: {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
name: name,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
args: args,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message: message,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
} else {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
return {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
valid: false,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message: "File does not exist",
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
} else {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
return {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
valid: false,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message: "Comamnd folder does not exist",
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Load the events
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
loadEvents(client: Client): IUtilResponse {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const folder = process.env.FOLDERS_EVENTS;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (existsSync(`${process.cwd()}/${folder}/`)) {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const eventFiles = readdirSync(`${process.cwd()}/${folder}/`);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
for (let i = 0; i < eventFiles.length; i++) {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
if (eventFiles[i].includes('.ts')) {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const eventName = eventFiles[i].split('.')[0];
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const file = require(`${process.cwd()}/${folder}/${eventName}.ts`);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
const event = new file[eventName]() as Event;
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
// Load events
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('channelCreate', event.channelCreate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('channelDelete', event.channelDelete);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('channelUpdate', event.channelUpdate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildBanAdd', event.guildBanAdd);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildBanRemove', event.guildBanRemove);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildCreate', event.guildCreate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildMemberAdd', event.guildMemberAdd);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildMemberRemove', event.guildMemberRemove);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('guildMemberUpdate', event.guildMemberUpdate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('message', event.message);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('messageDelete', event.messageDelete);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('messageUpdate', event.messageUpdate);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
client.on('ready', event.ready);
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
return {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
valid: true,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
} else {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
return {
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
valid: false,
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
message: "Event folder does not exist",
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"
}
VylpesTester commented 2021-07-18 19:48:11 +01:00 (Migrated from github.com)
Review

"Member is not part of message"

"Member is not part of message"

View file

@ -1,33 +0,0 @@
function generateResponse(isValid, message) {
return {
"valid": isValid,
"message": message || "No message was given"
}
}
function validateConfig(config, expect) {
if (!config) return generateResponse(false, "Invalid config");
if (typeof config != "object") return generateResponse(false, "Invalid config");
if (!expect) return generateResponse(false, "Invalid expect");
if (typeof expect != "object") return generateResponse(false, "Invalid expect");
const keys = Object.keys(expect);
for (const i in keys) {
const e = expect[keys[i]];
if (!config[keys[i]])
return generateResponse(false, `'${keys[i]}' is not defined`);
if (typeof config[keys[i]] != e.type)
return generateResponse(false, `Invalid type of '${keys[i]}'. Was '${typeof config[keys[i]]}', Expected '${e.type}'`);
}
return generateResponse(true);
}
module.exports = {
generateResponse,
validateConfig
};

View file

@ -0,0 +1,4 @@
export interface IBaseResponse {
valid: boolean;
message?: string;
}

View file

@ -0,0 +1,7 @@
import { Message } from "discord.js";
export interface ICommandContext {
name: string;
args: string[];
message: Message;
}

View file

@ -1,5 +0,0 @@
module.exports = {
client: require('./client/client'),
command: require('./type/command'),
event: require('./type/event')
}

5
src/index.ts Normal file
View file

@ -0,0 +1,5 @@
export { CoreClient } from "./client/client";
export { Command } from "./type/command";
export { Event } from "./type/event";
export { ICommandContext } from "./contracts/ICommandContext";

View file

@ -1,14 +0,0 @@
{
"token": {
"type": "string"
},
"prefix": {
"type": "string"
},
"commands": {
"type": "string"
},
"events": {
"type": "string"
}
}

107
src/package-lock.json generated
View file

@ -1,107 +0,0 @@
{
"name": "vylbot-core",
"version": "1.0.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@discordjs/collection": {
"version": "0.1.6",
"resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.1.6.tgz",
"integrity": "sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ=="
},
"@discordjs/form-data": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz",
"integrity": "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==",
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.8",
"mime-types": "^2.1.12"
}
},
"abort-controller": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz",
"integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==",
"requires": {
"event-target-shim": "^5.0.0"
}
},
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
},
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"requires": {
"delayed-stream": "~1.0.0"
}
},
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
},
"discord.js": {
"version": "12.3.1",
"resolved": "https://registry.npmjs.org/discord.js/-/discord.js-12.3.1.tgz",
"integrity": "sha512-mSFyV/mbvzH12UXdS4zadmeUf8IMQOo/YdunubG1wWt1xjWvtaJz/s9CGsFD2B5pTw1W/LXxxUbrQjIZ/xlUdw==",
"requires": {
"@discordjs/collection": "^0.1.6",
"@discordjs/form-data": "^3.0.1",
"abort-controller": "^3.0.0",
"node-fetch": "^2.6.0",
"prism-media": "^1.2.2",
"setimmediate": "^1.0.5",
"tweetnacl": "^1.0.3",
"ws": "^7.3.1"
}
},
"event-target-shim": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz",
"integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ=="
},
"mime-db": {
"version": "1.44.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.44.0.tgz",
"integrity": "sha512-/NOTfLrsPBVeH7YtFPgsVWveuL+4SjjYxaQ1xtM1KMFj7HdxlBlxeyNLzhyJVx7r4rZGJAZ/6lkKCitSc/Nmpg=="
},
"mime-types": {
"version": "2.1.27",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.27.tgz",
"integrity": "sha512-JIhqnCasI9yD+SsmkquHBxTSEuZdQX5BuQnS2Vc7puQQQ+8yiP5AY5uWhpdv4YL4VM5c6iliiYWPgJ/nJQLp7w==",
"requires": {
"mime-db": "1.44.0"
}
},
"node-fetch": {
"version": "2.6.1",
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
"integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw=="
},
"prism-media": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/prism-media/-/prism-media-1.2.2.tgz",
"integrity": "sha512-I+nkWY212lJ500jLe4tN9tWO7nRiBAVdMv76P9kffZjYhw20raMlW1HSSvS+MLXC9MmbNZCazMrAr+5jEEgTuw=="
},
"setimmediate": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
},
"tweetnacl": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-1.0.3.tgz",
"integrity": "sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw=="
},
"ws": {
"version": "7.5.0",
"resolved": "https://registry.npmjs.org/ws/-/ws-7.5.0.tgz",
"integrity": "sha512-6ezXvzOZupqKj4jUqbQ9tXuJNo+BR2gU8fFRk3XCP3e0G6WT414u5ELe6Y0vtp7kmSJ3F7YWObSNr1ESsgi4vw=="
}
}
}

View file

@ -1,75 +0,0 @@
class command {
constructor(run) {
this.run = run;
this._roles = [];
this._configs = [];
this._users = [];
}
// Description
get description() {
return this._description;
}
set description(description) {
this._description = description;
}
// Category
get category() {
return this._category;
}
set category(category) {
this._category = category;
}
// Usage
get usage() {
return this._usage;
}
set usage(usage) {
this._usage = usage;
}
// Roles
get roles() {
return this._roles;
}
set roles(role) {
this._roles.push(role);
}
// Config
get configs() {
return this._configs;
}
set configs(conf) {
this._configs.push(conf);
}
get requiredConfigs() {
console.warn("'requiredConfigs' is deprecated and will be removed in a future version. Please use 'configs' instead.");
return this._configs;
}
set requiredConfigs(conf) {
console.warn("'requiredConfigs' is deprecated and will be removed in a future version. Please use 'configs' instead.");
this._configs.push(conf);
}
// Users
get users() {
return this._users;
}
set users(userid) {
this._users.push(userid);
}
}
module.exports = command;

16
src/type/command.ts Normal file
View file

@ -0,0 +1,16 @@
import { Message } from "discord.js";
import { ICommandContext } from "../contracts/ICommandContext";
export class Command {
public _roles: string[];
public _category?: string;
constructor() {
this._roles = [];
}
public execute(context: ICommandContext) {
}
}

View file

@ -1,7 +0,0 @@
class event {
constructor(run) {
this.run = run;
}
}
module.exports = event;

55
src/type/event.ts Normal file
View file

@ -0,0 +1,55 @@
import { Channel, Guild, User, GuildMember, Message, PartialDMChannel, PartialGuildMember, PartialMessage } from "discord.js";
export class Event {
public channelCreate(channel: Channel) {
}
public channelDelete(channel: Channel | PartialDMChannel) {
}
public channelUpdate(oldChannel: Channel, newChannel: Channel) {
}
public guildBanAdd(guild: Guild, user: User) {
}
public guildBanRemove(guild: Guild, user: User) {
}
public guildCreate(guild: Guild) {
}
public guildMemberAdd(member: GuildMember) {
}
public guildMemberRemove(member: GuildMember | PartialGuildMember) {
}
public guildMemberUpdate(oldMember: GuildMember | PartialGuildMember, newMember: GuildMember) {
}
public message(message: Message) {
}
public messageDelete(message: Message | PartialMessage) {
}
public messageUpdate(oldMessage: Message | PartialMessage, newMessage: Message | PartialMessage) {
}
public ready() {
}
}

View file

@ -1,14 +0,0 @@
const { command } = require('../../src');
class test extends command {
constructor() {
super("test");
super.configs = "tester";
}
test(context) {
context.message.reply(`Testing done by ${context.config.tester}`);
}
}
module.exports = test;

View file

View file

@ -1,5 +0,0 @@
{
"testing": {
"tester": "General Kenobi"
}
}

View file

@ -1,6 +0,0 @@
{
"token": "TOKEN",
"prefix": "d!",
"commands": "tests/commands",
"events": "tests/events"
}

View file

@ -1,7 +0,0 @@
{
"guild": "000000000000000000",
"author": {
"bot": false
},
"content": "d!testing param1"
}

View file

@ -1,57 +0,0 @@
const { client } = require('../../../src');
const { readFileSync } = require('fs');
// Mocks
jest.mock('discord.js');
describe('Client Tests', () => {
let instance;
let config;
let commandConfig;
beforeEach(() => {
config = JSON.parse(readFileSync('tests/json/config.json'));
commandConfig = JSON.parse(readFileSync('tests/json/commandConfig.json'));
});
test('Configure Client (Correct paramaters)', () => {
instance = new client(config, commandConfig);
expect(instance.config).toBe(config);
expect(instance.events).toBeDefined();
expect(instance.util).toBeDefined();
});
test('Configure Client (Incorrect parameters: token)', () => {
expect(() => {
delete config.token;
instance = new client(config, commandConfig);
}).toThrow();
});
test('Configure Client (Incorrect parameters: prefix)', () => {
expect(() => {
delete config.prefix;
instance = new client(config, commandConfig);
}).toThrow();
});
test('Configure Client (Incorrect parameters: commands)', () => {
expect(() => {
delete config.commands;
instance = new client(config, commandConfig);
}).toThrow();
});
test('Configure Client (Incorrect parameters: events)', () => {
expect(() => {
delete config.events;
instance = new client(config, commandConfig);
}).toThrow();
});
test('Start Client', () => {
instance = new client(config, commandConfig);
instance.start();
});
});

View file

@ -1,89 +0,0 @@
const events = require('../../../src/client/events');
const { readFileSync } = require('fs');
// Mocks
jest.mock('discord.js');
describe('events.message', () => {
let instance;
let message;
let config;
beforeEach(() => {
instance = new events();
message = JSON.parse(readFileSync('tests/json/message.json'));
config = JSON.parse(readFileSync('tests/json/config.json'));
instance.config = config;
instance.util = jest.fn();
instance.util.loadCommand = jest.fn(() => {
return {
"valid": true,
"message": "No message was set"
}
});
});
test('If no message should return', () => {
const res = instance.message();
expect(res).toBe(false);
});
test('If no guild should return', () => {
delete message.guild;
const res = instance.message(message);
expect(res).toBe(false);
});
test('If author is a bot should return', () => {
message.author.bot = true;
const res = instance.message(message);
expect(res).toBe(false);
});
test('Should loadCommand', () => {
const res = instance.message(message);
expect(instance.util.loadCommand).toHaveBeenCalledTimes(1);
expect(instance.util.loadCommand).toHaveBeenCalledWith('testing', ['param1'], message);
});
test('Should return correct values', () => {
const res = instance.message(message);
expect(res.prefix).toBe('d!');
expect(res.name).toBe('testing');
expect(res.args[0]).toBe('param1');
expect(res.message).toBe(message);
});
test('Should throw if response is invalid', () => {
instance.util.loadCommand = jest.fn(() => {
return {
"valid": false,
"message": "Invalid"
}
});
expect(() => {
instance.message(message)
}).toThrow('Invalid');
});
test('Should not throw if file does not exist', () => {
instance.util.loadCommand = jest.fn(() => {
return {
"valid": false,
"message": "File does not exist"
}
});
expect(() => {
instance.message(message)
}).not.toThrow();
});
});

View file

@ -1,86 +0,0 @@
const util = require('../../../src/client/util');
const { readFileSync, read } = require('fs');
const { test, expect } = require('@jest/globals');
// Mocks
jest.mock('discord.js');
const fs = jest.createMockFromModule('fs');
fs.stat = jest.fn((path, cb) => {
cb(null);
});
describe('util.constructor', () => {
let instance;
let client;
beforeEach(() => {
client = jest.fn();
instance = new util(client);
});
test('Should set client', () => {
expect(instance._client).toBeDefined();
});
});
describe('util.loadCommand', () => {
let instance;
let message;
let client;
beforeEach(() => {
client = jest.fn();
client.config = JSON.parse(readFileSync('tests/json/config.json'));
client.commandConfig = JSON.parse(readFileSync('tests/json/commandConfig.json'));
instance = new util(client);
message = JSON.parse(readFileSync('tests/json/message.json'));
message.reply = jest.fn();
});
test('Should load command correctly', () => {
let res = instance.loadCommand('testing', 'param1', message);
expect(res.valid).toBe(true);
expect(res.message).toBe("loaded command 'testing' with arguments 'param1'");
});
test('Should load command correctly (no arguments)', () => {
let res = instance.loadCommand('testing', '', message);
expect(res.valid).toBe(true);
expect(res.message).toBe("loaded command 'testing' with arguments ''");
});
test('Should be invalid if it tries to load an undefined command', () => {
let res = instance.loadCommand('testingz', '', message);
expect(res.valid).toBe(false);
expect(res.message).toBe('File does not exist');
});
test('Should be invalid if incorrect configs', () => {
delete client.commandConfig.testing;
let res = instance.loadCommand('testing', 'param1', message);
expect(res.valid).toBe(false);
expect(res.message).toBe("test requires tester in it's configuration");
});
test('Should be invalid if incorrect configs (single config)', () => {
delete client.commandConfig.testing.tester;
let res = instance.loadCommand('testing', 'param1', message);
expect(res.valid).toBe(false);
expect(res.message).toBe("test requires tester in it's configuration");
});
test('Should throw error if command folder does not exist', () => {
client.config.commands = "falsefile";
let res = instance.loadCommand('testing', 'param1', message);
expect(res.valid).toBe(false);
expect(res.message).toBe('Command folder does not exist');
});
});

View file

@ -1,72 +0,0 @@
const { generateResponse, validateConfig } = require('../../../src/client/validation');
const { readFileSync } = require('fs');
describe('Validation: generateResponse', () => {
test('Returns the corect response', () => {
const isValidWithMessage = generateResponse(true, "Test Message");
const isValidNoMessage = generateResponse(true);
const notValidWithMessage = generateResponse(false, "Test Message");
const notValidNoMessage = generateResponse(false);
expect(isValidWithMessage.valid).toBe(true);
expect(isValidWithMessage.message).toBe('Test Message');
expect(isValidNoMessage.valid).toBe(true);
expect(isValidNoMessage.message).toBe('No message was given');
expect(notValidWithMessage.valid).toBe(false);
expect(notValidWithMessage.message).toBe('Test Message');
expect(notValidNoMessage.valid).toBe(false);
expect(notValidNoMessage.message).toBe('No message was given');
});
});
describe('Validation: validateConfig', () => {
let config;
let expected;
beforeEach(() => {
config = JSON.parse(readFileSync('tests/json/config.json'));
expected = JSON.parse(readFileSync('src/json/expectedConfig.json'));
});
test('Validates expected config as valid', () => {
const res = validateConfig(config, expected);
expect(res.valid).toBe(true);
expect(res.message).toBe('No message was given');
});
test('Validates unexpected config as invalid (token)', () => {
delete config.token;
const res = validateConfig(config, expected);
expect(res.valid).toBe(false);
expect(res.message).toBe("'token' is not defined");
});
test('Validates unexpected config as invalid (prefix)', () => {
delete config.prefix;
const res = validateConfig(config, expected);
expect(res.valid).toBe(false);
expect(res.message).toBe("'prefix' is not defined");
});
test('Validates unexpected config as invalid (commands)', () => {
delete config.commands;
const res = validateConfig(config, expected);
expect(res.valid).toBe(false);
expect(res.message).toBe("'commands' is not defined");
});
test('Validates unexpected config as invalid (events)', () => {
delete config.events;
const res = validateConfig(config, expected);
expect(res.valid).toBe(false);
expect(res.message).toBe("'events' is not defined");
});
});

View file

@ -1,190 +0,0 @@
const command = require('../../../src/type/command');
describe('Command: constructor', () => {
let instance;
beforeEach(() => {
instance = new command("test");
});
test('Command run is set correctly', () => {
expect(instance.run).toBe("test");
});
test('Command roles is set correctly', () => {
expect(typeof instance._roles).toBe('object');
expect(instance._roles.length).toBe(0);
});
test('Command configs is set correctly', () => {
expect(typeof instance._configs).toBe('object');
expect(instance._configs.length).toBe(0);
});
test('Command users is set correctly', () => {
expect(typeof instance._users).toBe('object');
expect(instance._users.length).toBe(0);
});
});
describe('Command: description', () => {
let instance;
beforeEach(() => {
instance = new command("test");
});
test('Setting description', () => {
instance.description = "desc";
expect(instance._description).toBe("desc");
});
test('Getting description', () => {
instance.description = "desc";
expect(instance.description).toBe("desc");
});
});
describe('Command: category', () => {
let instance;
beforeEach(() => {
instance = new command("test");
});
test('Setting category', () => {
instance.category = "cat";
expect(instance._category).toBe("cat");
});
test('Getting category', () => {
instance.category = "cat";
expect(instance.category).toBe("cat");
});
});
describe('Command: usage', () => {
let instance;
beforeEach(() => {
instance = new command("test");
});
test('Setting usage', () => {
instance.usage = "use";
expect(instance._usage).toBe("use");
});
test('Getting usage', () => {
instance.usage = "use";
expect(instance.usage).toBe("use");
});
});
describe('Command: roles', () => {
let instance;
beforeEach(() => {
instance = new command("test");
});
test('Setting roles (1 role)', () => {
instance.roles = "role0";
expect(instance._roles.length).toBe(1);
expect(instance._roles[0]).toBe("role0");
});
test('Getting roles (1 role)', () => {
instance.roles = "role0";
expect(instance.roles.length).toBe(1);
expect(instance.roles[0]).toBe("role0");
});
test('Setting roles (2 roles)', () => {
instance.roles = "role0";
instance.roles = "role1";
expect(instance._roles.length).toBe(2);
expect(instance._roles[0]).toBe("role0");
expect(instance._roles[1]).toBe("role1");
});
test('Getting roles (2 roles)', () => {
instance.roles = "role0";
instance.roles = "role1";
expect(instance.roles.length).toBe(2);
expect(instance.roles[0]).toBe("role0");
expect(instance.roles[1]).toBe("role1");
});
});
describe('Command: configs', () => {
let instance;
beforeEach(() => {
instance = new command("test");
});
test('Setting configs (1 config)', () => {
instance.configs = "config0";
expect(instance._configs.length).toBe(1);
expect(instance._configs[0]).toBe("config0");
});
test('Getting configs (1 config)', () => {
instance.configs = "config0";
expect(instance.configs.length).toBe(1);
expect(instance.configs[0]).toBe("config0");
});
test('Setting configs (2 configs)', () => {
instance.configs = "config0";
instance.configs = "config1";
expect(instance._configs.length).toBe(2);
expect(instance._configs[0]).toBe("config0");
expect(instance._configs[1]).toBe("config1");
});
test('Getting configs (2 configs)', () => {
instance.configs = "config0";
instance.configs = "config1";
expect(instance.configs.length).toBe(2);
expect(instance.configs[0]).toBe("config0");
expect(instance.configs[1]).toBe("config1");
});
});
describe('Command: users', () => {
let instance;
beforeEach(() => {
instance = new command("test");
});
test('Setting users (1 user)', () => {
instance.users = "user0";
expect(instance._users.length).toBe(1);
expect(instance._users[0]).toBe("user0");
});
test('Getting users (1 user)', () => {
instance.users = "user0";
expect(instance.users.length).toBe(1);
expect(instance.users[0]).toBe("user0");
});
test('Setting users (2 user)', () => {
instance.users = "user0";
instance.users = "user1";
expect(instance._users.length).toBe(2);
expect(instance._users[0]).toBe("user0");
expect(instance._users[1]).toBe("user1");
});
test('Getting users (2 users)', () => {
instance.users = "user0";
instance.users = "user1";
expect(instance.users.length).toBe(2);
expect(instance.users[0]).toBe("user0");
expect(instance.users[1]).toBe("user1");
});
});

View file

@ -1,13 +0,0 @@
const event = require('../../../src/type/event');
describe('Event: constructor', () => {
let instance;
beforeEach(() => {
instance = new event("test");
});
test('Event run is set correctly', () => {
expect(instance.run).toBe("test");
});
});

75
tsconfig.json Normal file
View file

@ -0,0 +1,75 @@
{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig.json to read more about this file */
/* Basic Options */
// "incremental": true, /* Enable incremental compilation */
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
// "lib": [], /* Specify library files to be included in the compilation. */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./dist", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
// "noUnusedLocals": true, /* Report errors on unused locals. */
// "noUnusedParameters": true, /* Report errors on unused parameters. */
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
// "noUncheckedIndexedAccess": true, /* Include 'undefined' in index signature results */
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an 'override' modifier. */
// "noPropertyAccessFromIndexSignature": true, /* Require undeclared properties from index signatures to use element accesses. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
},
"include": [
"./src",
]
}

112
yarn.lock Normal file
View file

@ -0,0 +1,112 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
"@discordjs/collection@^0.1.6":
version "0.1.6"
resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.1.6.tgz#9e9a7637f4e4e0688fd8b2b5c63133c91607682c"
integrity sha512-utRNxnd9kSS2qhyivo9lMlt5qgAUasH2gb7BEOn6p0efFh24gjGomHzWKMAPn2hEReOPQZCJaRKoURwRotKucQ==
"@discordjs/form-data@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@discordjs/form-data/-/form-data-3.0.1.tgz#5c9e6be992e2e57d0dfa0e39979a850225fb4697"
integrity sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"
"@types/node@^16.3.2":
version "16.3.2"
resolved "https://registry.yarnpkg.com/@types/node/-/node-16.3.2.tgz#655432817f83b51ac869c2d51dd8305fb8342e16"
integrity sha512-jJs9ErFLP403I+hMLGnqDRWT0RYKSvArxuBVh2veudHV7ifEC1WAmjJADacZ7mRbA2nWgHtn8xyECMAot0SkAw==
abort-controller@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392"
integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==
dependencies:
event-target-shim "^5.0.0"
asynckit@^0.4.0:
version "0.4.0"
resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
combined-stream@^1.0.8:
version "1.0.8"
resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f"
integrity sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==
dependencies:
delayed-stream "~1.0.0"
delayed-stream@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619"
integrity sha1-3zrhmayt+31ECqrgsp4icrJOxhk=
discord.js@^12.3.1:
version "12.5.3"
resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-12.5.3.tgz#56820d473c24320871df9ea0bbc6b462f21cf85c"
integrity sha512-D3nkOa/pCkNyn6jLZnAiJApw2N9XrIsXUAdThf01i7yrEuqUmDGc7/CexVWwEcgbQR97XQ+mcnqJpmJ/92B4Aw==
dependencies:
"@discordjs/collection" "^0.1.6"
"@discordjs/form-data" "^3.0.1"
abort-controller "^3.0.0"
node-fetch "^2.6.1"
prism-media "^1.2.9"
setimmediate "^1.0.5"
tweetnacl "^1.0.3"
ws "^7.4.4"
dotenv@^10.0.0:
version "10.0.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-10.0.0.tgz#3d4227b8fb95f81096cdd2b66653fb2c7085ba81"
integrity sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==
event-target-shim@^5.0.0:
version "5.0.1"
resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789"
integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==
mime-db@1.48.0:
version "1.48.0"
resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.48.0.tgz#e35b31045dd7eada3aaad537ed88a33afbef2d1d"
integrity sha512-FM3QwxV+TnZYQ2aRqhlKBMHxk10lTbMt3bBkMAp54ddrNeVSfcQYOOKuGuy3Ddrm38I04If834fOUSq1yzslJQ==
mime-types@^2.1.12:
version "2.1.31"
resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.31.tgz#a00d76b74317c61f9c2db2218b8e9f8e9c5c9e6b"
integrity sha512-XGZnNzm3QvgKxa8dpzyhFTHmpP3l5YNusmne07VUOXxou9CqUqYa/HBy124RqtVh/O2pECas/MOcsDgpilPOPg==
dependencies:
mime-db "1.48.0"
node-fetch@^2.6.1:
version "2.6.1"
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052"
integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==
prism-media@^1.2.9:
version "1.3.1"
resolved "https://registry.yarnpkg.com/prism-media/-/prism-media-1.3.1.tgz#418acd2b122bedea2e834056d678f9a5ad2943ae"
integrity sha512-nyYAa3KB4qteJIqdguKmwxTJgy55xxUtkJ3uRnOvO5jO+frci+9zpRXw6QZVcfDeva3S654fU9+26P2OSTzjHw==
setimmediate@^1.0.5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/setimmediate/-/setimmediate-1.0.5.tgz#290cbb232e306942d7d7ea9b83732ab7856f8285"
integrity sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=
tweetnacl@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/tweetnacl/-/tweetnacl-1.0.3.tgz#ac0af71680458d8a6378d0d0d050ab1407d35596"
integrity sha512-6rt+RN7aOi1nGMyC4Xa5DdYiukl2UWCbcJft7YhxReBGQD7OAM8Pbxw6YMo4r2diNEA8FEmu32YOn9rhaiE5yw==
typescript@^4.3.5:
version "4.3.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
ws@^7.4.4:
version "7.5.3"
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.3.tgz#160835b63c7d97bfab418fc1b8a9fced2ac01a74"
integrity sha512-kQ/dHIzuLrS6Je9+uv81ueZomEwH0qVYstcAQ4/Z93K8zeko9gtAbttJWzoC5ukqXY1PpoouV3+VSOqEAFt5wg==