Merge pull request #209 from VermiumSifell/dev
Refactoring code and updated vscode configurations
This commit is contained in:
commit
1313d8c0fa
29 changed files with 606 additions and 684 deletions
28
.cspell/custom-dictionary-workspace.txt
Normal file
28
.cspell/custom-dictionary-workspace.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
# Custom Dictionary Words
|
||||
Controlpanel
|
||||
dagen
|
||||
discordjs
|
||||
Följande
|
||||
gett
|
||||
Globalt
|
||||
Gåva
|
||||
hoster
|
||||
inom
|
||||
inställningar
|
||||
inte
|
||||
Krediter
|
||||
Nivå
|
||||
omdöme
|
||||
Omdöme
|
||||
Otillgänglig
|
||||
pino
|
||||
Poäng
|
||||
Profil
|
||||
satta
|
||||
senaste
|
||||
själv
|
||||
Språk
|
||||
Språkkod
|
||||
upsert
|
||||
uuidv
|
||||
Zyner
|
105
.vscode/extensions.json
vendored
105
.vscode/extensions.json
vendored
|
@ -1,53 +1,52 @@
|
|||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
|
||||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
||||
// List of extensions which should be recommended for users of this workspace.
|
||||
"recommendations": [
|
||||
"2gua.rainbow-brackets",
|
||||
"abrahamwilliam007.es7-javascript-class-snippets",
|
||||
"christian-kohler.npm-intellisense",
|
||||
"christian-kohler.path-intellisense",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"donjayamanne.githistory",
|
||||
"eamodio.gitlens",
|
||||
"esbenp.prettier-vscode",
|
||||
"github.github-vscode-theme",
|
||||
"irongeek.vscode-env",
|
||||
"xabikos.javascriptsnippets",
|
||||
"wix.vscode-import-cost",
|
||||
"vscode-icons-team.vscode-icons",
|
||||
"visualstudioexptteam.vscodeintellicode",
|
||||
"teledemic.branch-warnings",
|
||||
"tabnine.tabnine-vscode",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"seatonjiang.gitmoji-vscode",
|
||||
"sburg.vscode-javascript-booster",
|
||||
"kisstkondoros.vscode-codemetrics",
|
||||
"mgmcdermott.vscode-language-babel",
|
||||
"mhutchie.git-graph",
|
||||
"mikestead.dotenv",
|
||||
"mongodb.mongodb-vscode",
|
||||
"ms-vscode-remote.remote-wsl-recommender",
|
||||
"ms-vscode.js-debug",
|
||||
"ms-vscode.js-debug-companion",
|
||||
"ms-vscode.references-view",
|
||||
"ms-vscode.vscode-js-profile-table",
|
||||
"pflannery.vscode-versionlens",
|
||||
"adpyke.codesnap",
|
||||
"anan.devdocstab",
|
||||
"axosoft.gitkraken-glo",
|
||||
"gruntfuggly.todo-tree",
|
||||
"kiteco.kite",
|
||||
"lkytal.pomodoro",
|
||||
"wayou.vscode-todo-highlight",
|
||||
"johnpapa.vscode-peacock",
|
||||
"stepsize.stepsize",
|
||||
"nicoespeon.abracadabra",
|
||||
"sonarsource.sonarlint-vscode",
|
||||
"nicoespeon.hocus-pocus",
|
||||
"aaron-bond.better-comments",
|
||||
"oouo-diogo-perdigao.docthis"
|
||||
],
|
||||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
||||
"unwantedRecommendations": []
|
||||
}
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
|
||||
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
|
||||
// List of extensions which should be recommended for users of this workspace.
|
||||
"recommendations": [
|
||||
"abrahamwilliam007.es7-javascript-class-snippets",
|
||||
"christian-kohler.npm-intellisense",
|
||||
"christian-kohler.path-intellisense",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"donjayamanne.githistory",
|
||||
"eamodio.gitlens",
|
||||
"esbenp.prettier-vscode",
|
||||
"github.github-vscode-theme",
|
||||
"irongeek.vscode-env",
|
||||
"xabikos.javascriptsnippets",
|
||||
"wix.vscode-import-cost",
|
||||
"vscode-icons-team.vscode-icons",
|
||||
"visualstudioexptteam.vscodeintellicode",
|
||||
"teledemic.branch-warnings",
|
||||
"tabnine.tabnine-vscode",
|
||||
"streetsidesoftware.code-spell-checker",
|
||||
"seatonjiang.gitmoji-vscode",
|
||||
"sburg.vscode-javascript-booster",
|
||||
"kisstkondoros.vscode-codemetrics",
|
||||
"mgmcdermott.vscode-language-babel",
|
||||
"mhutchie.git-graph",
|
||||
"mikestead.dotenv",
|
||||
"mongodb.mongodb-vscode",
|
||||
"ms-vscode-remote.remote-wsl-recommender",
|
||||
"ms-vscode.js-debug",
|
||||
"ms-vscode.js-debug-companion",
|
||||
"ms-vscode.references-view",
|
||||
"ms-vscode.vscode-js-profile-table",
|
||||
"pflannery.vscode-versionlens",
|
||||
"adpyke.codesnap",
|
||||
"anan.devdocstab",
|
||||
"axosoft.gitkraken-glo",
|
||||
"gruntfuggly.todo-tree",
|
||||
"kiteco.kite",
|
||||
"lkytal.pomodoro",
|
||||
"wayou.vscode-todo-highlight",
|
||||
"johnpapa.vscode-peacock",
|
||||
"stepsize.stepsize",
|
||||
"nicoespeon.abracadabra",
|
||||
"sonarsource.sonarlint-vscode",
|
||||
"nicoespeon.hocus-pocus",
|
||||
"aaron-bond.better-comments",
|
||||
"oouo-diogo-perdigao.docthis"
|
||||
],
|
||||
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
|
||||
"unwantedRecommendations": []
|
||||
}
|
||||
|
|
67
.vscode/settings.json
vendored
67
.vscode/settings.json
vendored
|
@ -1,53 +1,26 @@
|
|||
{
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.wordWrapColumn": 100,
|
||||
"editor.tabSize": 2,
|
||||
"editor.formatOnSave": true,
|
||||
"files.eol": "\n",
|
||||
"prettier.endOfLine": "lf",
|
||||
"prettier.singleQuote": true,
|
||||
"prettier.trailingComma": "es5",
|
||||
"peacock.color": "#369",
|
||||
"editor.bracketPairColorization.enabled": true,
|
||||
"editor.codeActionsOnSave": ["source.formatDocument", "source.fixAll.eslint"],
|
||||
"cSpell.words": [
|
||||
"Controlpanel",
|
||||
"discordjs",
|
||||
"hoster",
|
||||
"pino",
|
||||
"runned",
|
||||
"Sifell",
|
||||
"Timout",
|
||||
"upsert",
|
||||
"uuidv",
|
||||
"Vermium",
|
||||
"Xyter",
|
||||
"Xyter's",
|
||||
"Zyner"
|
||||
],
|
||||
"editor.cursorBlinking": "phase",
|
||||
"editor.cursorSmoothCaretAnimation": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"editor.fontFamily": "Cascadia Code",
|
||||
"editor.fontLigatures": true,
|
||||
"git.enableCommitSigning": true,
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib",
|
||||
"[typescript]": {
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
||||
},
|
||||
"workbench.colorCustomizations": {
|
||||
"activityBar.activeBackground": "#407fbf",
|
||||
"activityBar.activeBorder": "#77284f",
|
||||
"activityBar.background": "#407fbf",
|
||||
"activityBar.foreground": "#e7e7e7",
|
||||
"activityBar.inactiveForeground": "#e7e7e799",
|
||||
"activityBarBadge.background": "#77284f",
|
||||
"activityBarBadge.foreground": "#e7e7e7",
|
||||
"sash.hoverBorder": "#407fbf",
|
||||
"statusBar.background": "#336699",
|
||||
"statusBar.foreground": "#e7e7e7",
|
||||
"statusBarItem.hoverBackground": "#407fbf",
|
||||
"statusBarItem.remoteBackground": "#336699",
|
||||
"statusBarItem.remoteForeground": "#e7e7e7",
|
||||
"titleBar.activeBackground": "#336699",
|
||||
"titleBar.activeForeground": "#e7e7e7",
|
||||
"titleBar.inactiveBackground": "#33669999",
|
||||
"titleBar.inactiveForeground": "#e7e7e799"
|
||||
"editor.formatOnSave": true,
|
||||
"editor.guides.bracketPairs": "active",
|
||||
"editor.minimap.maxColumn": 200,
|
||||
"editor.minimap.renderCharacters": false,
|
||||
"editor.minimap.showSlider": "always",
|
||||
"editor.tabSize": 2,
|
||||
"editor.wordWrapColumn": 100,
|
||||
"files.eol": "\n",
|
||||
"files.trimTrailingWhitespace": true,
|
||||
"cSpell.customDictionaries": {
|
||||
"custom-dictionary-workspace": {
|
||||
"name": "custom-dictionary-workspace",
|
||||
"path": "${workspaceFolder:xyter}/.cspell/custom-dictionary-workspace.txt",
|
||||
"addWords": true,
|
||||
"scope": "workspace"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
theme: jekyll-theme-cayman
|
|
@ -1,37 +0,0 @@
|
|||
## Welcome to GitHub Pages
|
||||
|
||||
You can use the [editor on GitHub](https://github.com/ZynerOrg/xyter/edit/main/docs/index.md) to maintain and preview the content for your website in Markdown files.
|
||||
|
||||
Whenever you commit to this repository, GitHub Pages will run [Jekyll](https://jekyllrb.com/) to rebuild the pages in your site, from the content in your Markdown files.
|
||||
|
||||
### Markdown
|
||||
|
||||
Markdown is a lightweight and easy-to-use syntax for styling your writing. It includes conventions for
|
||||
|
||||
```markdown
|
||||
Syntax highlighted code block
|
||||
|
||||
# Header 1
|
||||
## Header 2
|
||||
### Header 3
|
||||
|
||||
- Bulleted
|
||||
- List
|
||||
|
||||
1. Numbered
|
||||
2. List
|
||||
|
||||
**Bold** and _Italic_ and `Code` text
|
||||
|
||||
[Link](url) and 
|
||||
```
|
||||
|
||||
For more details see [Basic writing and formatting syntax](https://docs.github.com/en/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax).
|
||||
|
||||
### Jekyll Themes
|
||||
|
||||
Your Pages site will use the layout and styles from the Jekyll theme you have selected in your [repository settings](https://github.com/ZynerOrg/xyter/settings/pages). The name of this theme is saved in the Jekyll `_config.yml` configuration file.
|
||||
|
||||
### Support or Contact
|
||||
|
||||
Having trouble with Pages? Check out our [documentation](https://docs.github.com/categories/github-pages-basics/) or [contact support](https://support.github.com/contact) and we’ll help you sort it out.
|
|
@ -56,8 +56,10 @@ export default async (interaction: CommandInteraction) => {
|
|||
const userDB = await fetchUser(user, guild);
|
||||
|
||||
if (userDB === null) return;
|
||||
if (guildDB === null) return;
|
||||
if (guildDB.shop === null) return;
|
||||
|
||||
const { pricePerHour } = guildDB?.shop?.roles;
|
||||
const { pricePerHour } = guildDB.shop.roles;
|
||||
|
||||
userDB.credits -= pricePerHour;
|
||||
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import users from "../../helpers/database/models/userSchema";
|
||||
import logger from "../../handlers/logger";
|
||||
|
||||
import { GuildMember } from "discord.js";
|
||||
import updatePresence from "../../helpers/updatePresence";
|
||||
import fetchUser from "../../helpers/fetchUser";
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
import users from "../../helpers/database/models/userSchema";
|
||||
import logger from "../../handlers/logger";
|
||||
|
||||
import { GuildMember } from "discord.js";
|
||||
import updatePresence from "../../helpers/updatePresence";
|
||||
import dropUser from "../../helpers/dropUser";
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
// Dependencies
|
||||
import { Message } from "discord.js";
|
||||
|
||||
// Models
|
||||
import userSchema from "../../helpers/database/models/userSchema";
|
||||
import guildSchema from "../../helpers/database/models/guildSchema";
|
||||
|
||||
// Modules
|
||||
import points from "./modules/points";
|
||||
import credits from "./modules/credits";
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import logger from "../../../handlers/logger";
|
||||
import counters from "../../../helpers/database/models/counterSchema";
|
||||
|
||||
import { Message } from "discord.js";
|
||||
|
|
|
@ -1,70 +1,70 @@
|
|||
import logger from '../../../handlers/logger';
|
||||
import timeouts from '../../../helpers/database/models/timeoutSchema';
|
||||
import { Message } from 'discord.js';
|
||||
export default async (guildDB: any, userDB: any, message: Message) => {
|
||||
const { guild, author, channel, content } = message;
|
||||
|
||||
// If message length is below guild minimum length
|
||||
if (content.length < guildDB.credits.minimumLength) return;
|
||||
|
||||
// Check if user has a timeout
|
||||
const isTimeout = await timeouts.findOne({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: '2022-03-15-17-42',
|
||||
});
|
||||
|
||||
// If user is not on timeout
|
||||
if (!isTimeout) {
|
||||
// Add credits to user
|
||||
|
||||
userDB.credits += guildDB.credits.rate;
|
||||
|
||||
await userDB
|
||||
.save()
|
||||
.then(async () => {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${channel.id} credits add ${guildDB.credits.rate} balance: ${userDB.credits}`
|
||||
);
|
||||
})
|
||||
.catch(async (e: any) => {
|
||||
// Send error message
|
||||
await logger.error(e);
|
||||
});
|
||||
|
||||
// Create a timeout for the user
|
||||
await timeouts.create({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: '2022-03-15-17-42',
|
||||
});
|
||||
|
||||
setTimeout(async () => {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${
|
||||
channel.id
|
||||
} has not talked within last ${
|
||||
guildDB.credits.timeout / 1000
|
||||
} seconds, credits can be given`
|
||||
);
|
||||
|
||||
// When timeout is out, remove it from the database
|
||||
await timeouts.deleteOne({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: '2022-03-15-17-42',
|
||||
});
|
||||
}, guildDB.credits.timeout);
|
||||
} else {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${
|
||||
channel.id
|
||||
} has talked within last ${
|
||||
guildDB.credits.timeout / 1000
|
||||
} seconds, no credits given`
|
||||
);
|
||||
}
|
||||
};
|
||||
import logger from "../../../handlers/logger";
|
||||
import timeouts from "../../../helpers/database/models/timeoutSchema";
|
||||
import { Message } from "discord.js";
|
||||
export default async (guildDB: any, userDB: any, message: Message) => {
|
||||
const { guild, author, channel, content } = message;
|
||||
|
||||
// If message length is below guild minimum length
|
||||
if (content.length < guildDB.credits.minimumLength) return;
|
||||
|
||||
// Check if user has a timeout
|
||||
const isTimeout = await timeouts.findOne({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: "2022-03-15-17-42",
|
||||
});
|
||||
|
||||
// If user is not on timeout
|
||||
if (!isTimeout) {
|
||||
// Add credits to user
|
||||
|
||||
userDB.credits += guildDB.credits.rate;
|
||||
|
||||
await userDB
|
||||
.save()
|
||||
.then(async () => {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${channel.id} credits add ${guildDB.credits.rate} balance: ${userDB.credits}`
|
||||
);
|
||||
})
|
||||
.catch(async (e: any) => {
|
||||
// Send error message
|
||||
await logger.error(e);
|
||||
});
|
||||
|
||||
// Create a timeout for the user
|
||||
await timeouts.create({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: "2022-03-15-17-42",
|
||||
});
|
||||
|
||||
setTimeout(async () => {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${
|
||||
channel.id
|
||||
} has not talked within last ${
|
||||
guildDB.credits.timeout / 1000
|
||||
} seconds, credits can be given`
|
||||
);
|
||||
|
||||
// When timeout is out, remove it from the database
|
||||
await timeouts.deleteOne({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: "2022-03-15-17-42",
|
||||
});
|
||||
}, guildDB.credits.timeout);
|
||||
} else {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${
|
||||
channel.id
|
||||
} has talked within last ${
|
||||
guildDB.credits.timeout / 1000
|
||||
} seconds, no credits given`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,70 +1,70 @@
|
|||
import logger from '../../../handlers/logger';
|
||||
import timeouts from '../../../helpers/database/models/timeoutSchema';
|
||||
|
||||
import { Message } from 'discord.js';
|
||||
export default async (guildDB: any, userDB: any, message: Message) => {
|
||||
const { author, guild, channel, content } = message;
|
||||
|
||||
// If message length is below guild minimum length
|
||||
if (content.length < guildDB.points.minimumLength) return;
|
||||
|
||||
// Check if user has a timeout
|
||||
const isTimeout = await timeouts.findOne({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: '2022-03-15-17-41',
|
||||
});
|
||||
|
||||
// If user is not on timeout
|
||||
if (!isTimeout) {
|
||||
// Add points to user
|
||||
userDB.points += guildDB.points.rate;
|
||||
|
||||
await userDB
|
||||
.save()
|
||||
.then(async () => {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${channel.id} points add: ${guildDB.points.rate} balance: ${userDB.points}`
|
||||
);
|
||||
})
|
||||
.catch(async (e: any) => {
|
||||
// Send error message
|
||||
await logger.error(e);
|
||||
});
|
||||
|
||||
// Create a timeout for the user
|
||||
await timeouts.create({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: '2022-03-15-17-41',
|
||||
});
|
||||
|
||||
setTimeout(async () => {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${
|
||||
channel.id
|
||||
} has not talked within last ${
|
||||
guildDB.points.timeout / 1000
|
||||
} seconds, points can be given`
|
||||
);
|
||||
|
||||
// When timeout is out, remove it from the database
|
||||
await timeouts.deleteOne({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: '2022-03-15-17-41',
|
||||
});
|
||||
}, guildDB.points.timeout);
|
||||
} else {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${
|
||||
channel.id
|
||||
} has talked within last ${
|
||||
guildDB.points.timeout / 1000
|
||||
} seconds, no points given`
|
||||
);
|
||||
}
|
||||
};
|
||||
import logger from "../../../handlers/logger";
|
||||
import timeouts from "../../../helpers/database/models/timeoutSchema";
|
||||
|
||||
import { Message } from "discord.js";
|
||||
export default async (guildDB: any, userDB: any, message: Message) => {
|
||||
const { author, guild, channel, content } = message;
|
||||
|
||||
// If message length is below guild minimum length
|
||||
if (content.length < guildDB.points.minimumLength) return;
|
||||
|
||||
// Check if user has a timeout
|
||||
const isTimeout = await timeouts.findOne({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: "2022-03-15-17-41",
|
||||
});
|
||||
|
||||
// If user is not on timeout
|
||||
if (!isTimeout) {
|
||||
// Add points to user
|
||||
userDB.points += guildDB.points.rate;
|
||||
|
||||
await userDB
|
||||
.save()
|
||||
.then(async () => {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${channel.id} points add: ${guildDB.points.rate} balance: ${userDB.points}`
|
||||
);
|
||||
})
|
||||
.catch(async (e: any) => {
|
||||
// Send error message
|
||||
await logger.error(e);
|
||||
});
|
||||
|
||||
// Create a timeout for the user
|
||||
await timeouts.create({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: "2022-03-15-17-41",
|
||||
});
|
||||
|
||||
setTimeout(async () => {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${
|
||||
channel.id
|
||||
} has not talked within last ${
|
||||
guildDB.points.timeout / 1000
|
||||
} seconds, points can be given`
|
||||
);
|
||||
|
||||
// When timeout is out, remove it from the database
|
||||
await timeouts.deleteOne({
|
||||
guildId: guild?.id,
|
||||
userId: author.id,
|
||||
timeoutId: "2022-03-15-17-41",
|
||||
});
|
||||
}, guildDB.points.timeout);
|
||||
} else {
|
||||
// Send debug message
|
||||
await logger.debug(
|
||||
`Guild: ${guild?.id} User: ${author.id} Channel: ${
|
||||
channel.id
|
||||
} has talked within last ${
|
||||
guildDB.points.timeout / 1000
|
||||
} seconds, no points given`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import fs from 'fs'; // fs
|
||||
import { Collection } from 'discord.js'; // discord.js
|
||||
import { Client } from '../types/common/discord';
|
||||
import fs from "fs"; // fs
|
||||
import { Collection } from "discord.js"; // discord.js
|
||||
import { Client } from "../types/common/discord";
|
||||
export default async (client: Client) => {
|
||||
client.commands = new Collection();
|
||||
const commandFiles = fs.readdirSync('./src/commands');
|
||||
const commandFiles = fs.readdirSync("./src/commands");
|
||||
|
||||
for (const file of commandFiles) {
|
||||
const command = require(`../commands/${file}`);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import fs from 'fs'; // fs
|
||||
import { Client } from 'discord.js'; // discord.js
|
||||
import fs from "fs"; // fs
|
||||
import { Client } from "discord.js"; // discord.js
|
||||
|
||||
export default async (client: Client) => {
|
||||
const eventFiles = fs.readdirSync('./src/events');
|
||||
const eventFiles = fs.readdirSync("./src/events");
|
||||
|
||||
for (const file of eventFiles) {
|
||||
const event = require(`../events/${file}`);
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import events from './events';
|
||||
import commands from './commands';
|
||||
import locale from './locale';
|
||||
import schedules from './schedules';
|
||||
|
||||
export default { events, commands, locale, schedules };
|
|
@ -1,135 +1,135 @@
|
|||
import i18next from 'i18next';
|
||||
|
||||
export default async () => {
|
||||
await i18next.init({
|
||||
lng: 'en', // if you're using a language detector, do not define the lng option
|
||||
// debug: true,
|
||||
fallbackLng: 'en',
|
||||
resources: {
|
||||
en: {
|
||||
general: { not_available: 'Not Available' },
|
||||
commands: {
|
||||
credits: {
|
||||
general: {
|
||||
credits_one: '{{count}} credit',
|
||||
credits_other: '{{count}} credits',
|
||||
},
|
||||
addons: {
|
||||
balance: { embed: { title: 'Credits' } },
|
||||
gift: { embed: { title: 'Gift' } },
|
||||
},
|
||||
},
|
||||
reputation: {
|
||||
addons: {
|
||||
give: {
|
||||
version01: {
|
||||
embed: {
|
||||
title: ':medal: Reputation',
|
||||
description:
|
||||
'You have given reputation within the last day, you can not repute now!',
|
||||
},
|
||||
},
|
||||
version02: {
|
||||
embed: {
|
||||
title: ':medal: Reputation',
|
||||
description:
|
||||
'You have given {{user}} a {{type}} reputation!',
|
||||
},
|
||||
},
|
||||
version03: {
|
||||
embed: {
|
||||
title: ':medal: Reputation',
|
||||
description: 'You can not repute yourself.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
profile: {
|
||||
addons: {
|
||||
view: {
|
||||
embed: {
|
||||
title: 'Profile',
|
||||
reputation: 'Reputation (Global)',
|
||||
level: 'Level (Guild)',
|
||||
points: 'Points (Guild)',
|
||||
credits: 'Credits (Guild)',
|
||||
language_code: 'Language Code (Global)',
|
||||
},
|
||||
},
|
||||
settings: {
|
||||
embed: {
|
||||
title: 'Profile',
|
||||
description: 'Following settings is set',
|
||||
fields: { language: 'Language' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
sv: {
|
||||
general: { not_available: 'Otillgänglig' },
|
||||
commands: {
|
||||
credits: {
|
||||
general: {
|
||||
credits_one: '{{count}} krona',
|
||||
credits_other: '{{count}} kronor',
|
||||
},
|
||||
addons: {
|
||||
balance: { embed: { title: 'Krediter' } },
|
||||
gift: { embed: { title: 'Gåva' } },
|
||||
},
|
||||
},
|
||||
reputation: {
|
||||
addons: {
|
||||
give: {
|
||||
version01: {
|
||||
embed: {
|
||||
title: ':medal: Omdöme',
|
||||
description:
|
||||
'Du har redan gett omdöme inom den senaste dagen, du kan inte ge ett omdöme just nu!',
|
||||
},
|
||||
},
|
||||
version02: {
|
||||
embed: {
|
||||
title: ':medal: Omdöme',
|
||||
description: 'Du har gett {{user}} ett {{type}} omdöme!',
|
||||
},
|
||||
},
|
||||
version03: {
|
||||
embed: {
|
||||
title: ':medal: Omdöme',
|
||||
description: 'Du kan inte ge dig själv ett omdöme.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
profile: {
|
||||
addons: {
|
||||
view: {
|
||||
embed: {
|
||||
title: 'Profil',
|
||||
reputation: 'Omdöme (Globalt)',
|
||||
level: 'Nivå (Server)',
|
||||
points: 'Poäng (Server)',
|
||||
credits: 'Krediter (Server)',
|
||||
language_code: 'Språkkod (Globalt)',
|
||||
},
|
||||
},
|
||||
settings: {
|
||||
embed: {
|
||||
title: 'Profil',
|
||||
description: 'Följande inställningar är satta',
|
||||
fields: { language: 'Språk' },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
import i18next from "i18next";
|
||||
|
||||
export default async () => {
|
||||
await i18next.init({
|
||||
lng: "en", // if you're using a language detector, do not define the lng option
|
||||
// debug: true,
|
||||
fallbackLng: "en",
|
||||
resources: {
|
||||
en: {
|
||||
general: { not_available: "Not Available" },
|
||||
commands: {
|
||||
credits: {
|
||||
general: {
|
||||
credits_one: "{{count}} credit",
|
||||
credits_other: "{{count}} credits",
|
||||
},
|
||||
addons: {
|
||||
balance: { embed: { title: "Credits" } },
|
||||
gift: { embed: { title: "Gift" } },
|
||||
},
|
||||
},
|
||||
reputation: {
|
||||
addons: {
|
||||
give: {
|
||||
version01: {
|
||||
embed: {
|
||||
title: ":medal: Reputation",
|
||||
description:
|
||||
"You have given reputation within the last day, you can not repute now!",
|
||||
},
|
||||
},
|
||||
version02: {
|
||||
embed: {
|
||||
title: ":medal: Reputation",
|
||||
description:
|
||||
"You have given {{user}} a {{type}} reputation!",
|
||||
},
|
||||
},
|
||||
version03: {
|
||||
embed: {
|
||||
title: ":medal: Reputation",
|
||||
description: "You can not repute yourself.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
profile: {
|
||||
addons: {
|
||||
view: {
|
||||
embed: {
|
||||
title: "Profile",
|
||||
reputation: "Reputation (Global)",
|
||||
level: "Level (Guild)",
|
||||
points: "Points (Guild)",
|
||||
credits: "Credits (Guild)",
|
||||
language_code: "Language Code (Global)",
|
||||
},
|
||||
},
|
||||
settings: {
|
||||
embed: {
|
||||
title: "Profile",
|
||||
description: "Following settings is set",
|
||||
fields: { language: "Language" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
sv: {
|
||||
general: { not_available: "Otillgänglig" },
|
||||
commands: {
|
||||
credits: {
|
||||
general: {
|
||||
credits_one: "{{count}} krona",
|
||||
credits_other: "{{count}} kronor",
|
||||
},
|
||||
addons: {
|
||||
balance: { embed: { title: "Krediter" } },
|
||||
gift: { embed: { title: "Gåva" } },
|
||||
},
|
||||
},
|
||||
reputation: {
|
||||
addons: {
|
||||
give: {
|
||||
version01: {
|
||||
embed: {
|
||||
title: ":medal: Omdöme",
|
||||
description:
|
||||
"Du har redan gett omdöme inom den senaste dagen, du kan inte ge ett omdöme just nu!",
|
||||
},
|
||||
},
|
||||
version02: {
|
||||
embed: {
|
||||
title: ":medal: Omdöme",
|
||||
description: "Du har gett {{user}} ett {{type}} omdöme!",
|
||||
},
|
||||
},
|
||||
version03: {
|
||||
embed: {
|
||||
title: ":medal: Omdöme",
|
||||
description: "Du kan inte ge dig själv ett omdöme.",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
profile: {
|
||||
addons: {
|
||||
view: {
|
||||
embed: {
|
||||
title: "Profil",
|
||||
reputation: "Omdöme (Globalt)",
|
||||
level: "Nivå (Server)",
|
||||
points: "Poäng (Server)",
|
||||
credits: "Krediter (Server)",
|
||||
language_code: "Språkkod (Globalt)",
|
||||
},
|
||||
},
|
||||
settings: {
|
||||
embed: {
|
||||
title: "Profil",
|
||||
description: "Följande inställningar är satta",
|
||||
fields: { language: "Språk" },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import pino from 'pino';
|
||||
import * as config from '../../config.json';
|
||||
import pino from "pino";
|
||||
import * as config from "../../config.json";
|
||||
|
||||
export default pino({ level: config.debug ? 'debug' : 'info' });
|
||||
export default pino({ level: config.debug ? "debug" : "info" });
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import mongoose from 'mongoose';
|
||||
import mongoose from "mongoose";
|
||||
|
||||
import * as config from '../../../config.json';
|
||||
import logger from '../../handlers/logger';
|
||||
import * as config from "../../../config.json";
|
||||
import logger from "../../handlers/logger";
|
||||
|
||||
export default async () =>
|
||||
{
|
||||
await mongoose.connect(config.mongodb.url);
|
||||
logger.info('Connected to the database');
|
||||
export default async () => {
|
||||
await mongoose.connect(config.mongodb.url);
|
||||
logger.info("Connected to the database");
|
||||
};
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
import mongoose from 'mongoose';
|
||||
|
||||
const counterSchema = new mongoose.Schema(
|
||||
{
|
||||
guildId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
channelId: {
|
||||
type: mongoose.SchemaTypes.String,
|
||||
required: true,
|
||||
unique: true,
|
||||
index: true,
|
||||
},
|
||||
word: {
|
||||
type: mongoose.SchemaTypes.String,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
counter: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
export default mongoose.model('counter', counterSchema);
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const counterSchema = new mongoose.Schema(
|
||||
{
|
||||
guildId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
channelId: {
|
||||
type: mongoose.SchemaTypes.String,
|
||||
required: true,
|
||||
unique: true,
|
||||
index: true,
|
||||
},
|
||||
word: {
|
||||
type: mongoose.SchemaTypes.String,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
counter: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
export default mongoose.model("counter", counterSchema);
|
||||
|
|
|
@ -1,71 +1,71 @@
|
|||
import mongoose from 'mongoose';
|
||||
|
||||
const guildSchema = new mongoose.Schema(
|
||||
{
|
||||
guildId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: true,
|
||||
index: true,
|
||||
},
|
||||
credits: {
|
||||
status: {
|
||||
type: mongoose.SchemaTypes.Boolean,
|
||||
default: true,
|
||||
},
|
||||
rate: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 1,
|
||||
},
|
||||
minimumLength: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5,
|
||||
},
|
||||
timeout: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5000,
|
||||
},
|
||||
workRate: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 15,
|
||||
},
|
||||
workTimeout: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 900000,
|
||||
},
|
||||
},
|
||||
shop: {
|
||||
roles: {
|
||||
status: {
|
||||
type: mongoose.SchemaTypes.Boolean,
|
||||
default: true,
|
||||
},
|
||||
pricePerHour: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
points: {
|
||||
status: {
|
||||
type: mongoose.SchemaTypes.Boolean,
|
||||
default: false,
|
||||
},
|
||||
rate: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 1,
|
||||
},
|
||||
minimumLength: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5,
|
||||
},
|
||||
timeout: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5000,
|
||||
},
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
export default mongoose.model('guild', guildSchema);
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const guildSchema = new mongoose.Schema(
|
||||
{
|
||||
guildId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: true,
|
||||
index: true,
|
||||
},
|
||||
credits: {
|
||||
status: {
|
||||
type: mongoose.SchemaTypes.Boolean,
|
||||
default: true,
|
||||
},
|
||||
rate: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 1,
|
||||
},
|
||||
minimumLength: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5,
|
||||
},
|
||||
timeout: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5000,
|
||||
},
|
||||
workRate: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 15,
|
||||
},
|
||||
workTimeout: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 900000,
|
||||
},
|
||||
},
|
||||
shop: {
|
||||
roles: {
|
||||
status: {
|
||||
type: mongoose.SchemaTypes.Boolean,
|
||||
default: true,
|
||||
},
|
||||
pricePerHour: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5,
|
||||
},
|
||||
},
|
||||
},
|
||||
points: {
|
||||
status: {
|
||||
type: mongoose.SchemaTypes.Boolean,
|
||||
default: false,
|
||||
},
|
||||
rate: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 1,
|
||||
},
|
||||
minimumLength: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5,
|
||||
},
|
||||
timeout: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
default: 5000,
|
||||
},
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
export default mongoose.model("guild", guildSchema);
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
import users from './userSchema';
|
||||
import guilds from './guildSchema';
|
||||
import apis from './apiSchema';
|
||||
import timeouts from './timeoutSchema';
|
||||
import counters from './counterSchema';
|
||||
import shopRoles from './shopRolesSchema';
|
||||
|
||||
export default {
|
||||
users,
|
||||
guilds,
|
||||
apis,
|
||||
timeouts,
|
||||
counters,
|
||||
shopRoles,
|
||||
};
|
|
@ -1,39 +1,39 @@
|
|||
import mongoose from 'mongoose';
|
||||
|
||||
const shopRoleSchema = new mongoose.Schema(
|
||||
{
|
||||
roleId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
userId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
guildId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
pricePerHour: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
default: 5,
|
||||
},
|
||||
lastPayed: {
|
||||
type: mongoose.SchemaTypes.Date,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
export default mongoose.model('shopRole', shopRoleSchema);
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const shopRoleSchema = new mongoose.Schema(
|
||||
{
|
||||
roleId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
userId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
guildId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
pricePerHour: {
|
||||
type: mongoose.SchemaTypes.Number,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
default: 5,
|
||||
},
|
||||
lastPayed: {
|
||||
type: mongoose.SchemaTypes.Date,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
export default mongoose.model("shopRole", shopRoleSchema);
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import mongoose from 'mongoose';
|
||||
|
||||
const timeoutSchema = new mongoose.Schema(
|
||||
{
|
||||
userId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
guildId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
timeoutId: { type: mongoose.SchemaTypes.String },
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
export default mongoose.model('timeout', timeoutSchema);
|
||||
import mongoose from "mongoose";
|
||||
|
||||
const timeoutSchema = new mongoose.Schema(
|
||||
{
|
||||
userId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
guildId: {
|
||||
type: mongoose.SchemaTypes.Decimal128,
|
||||
required: true,
|
||||
unique: false,
|
||||
index: true,
|
||||
},
|
||||
timeoutId: { type: mongoose.SchemaTypes.String },
|
||||
},
|
||||
{ timestamps: true }
|
||||
);
|
||||
|
||||
export default mongoose.model("timeout", timeoutSchema);
|
||||
|
|
|
@ -1,31 +1,24 @@
|
|||
// TODO This file will make sure that all guilds always has at least one entry in all collections with "guildId"
|
||||
|
||||
import apis from "./database/models/apiSchema"
|
||||
import guilds from "./database/models/guildSchema"
|
||||
import apis from "./database/models/apiSchema";
|
||||
import guilds from "./database/models/guildSchema";
|
||||
|
||||
import logger from '../handlers/logger';
|
||||
import { Guild } from 'discord.js';
|
||||
import logger from "../handlers/logger";
|
||||
import { Guild } from "discord.js";
|
||||
|
||||
export default async (guild: Guild) =>
|
||||
{
|
||||
export default async (guild: Guild) => {
|
||||
const api = await apis.findOne({ guildId: guild.id });
|
||||
const guildData = await guilds.findOne({ guildId: guild.id });
|
||||
if (!api)
|
||||
{
|
||||
if (!api) {
|
||||
apis.create({ guildId: guild.id });
|
||||
logger.debug(`Guild: ${guild.id} added api collection`);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
logger.debug(`Guild: ${guild.id} already in api collection`);
|
||||
}
|
||||
if (!guildData)
|
||||
{
|
||||
if (!guildData) {
|
||||
guilds.create({ guildId: guild.id });
|
||||
logger.debug(`Guild: ${guild.id} added guild collection`);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
logger.debug(`Guild: ${guild.id} already in guild collection`);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,27 +1,21 @@
|
|||
import users from './database/models/userSchema';
|
||||
import logger from '../handlers/logger';
|
||||
import { Guild, User } from 'discord.js';
|
||||
import users from "./database/models/userSchema";
|
||||
import logger from "../handlers/logger";
|
||||
import { Guild, User } from "discord.js";
|
||||
|
||||
export default async (user: User, guild: Guild) =>
|
||||
{
|
||||
export default async (user: User, guild: Guild) => {
|
||||
const userData = await users.findOne({ userId: user.id, guildId: guild.id });
|
||||
if (!userData)
|
||||
{
|
||||
if (!userData) {
|
||||
users
|
||||
.create({ userId: user.id, guildId: guild.id })
|
||||
.then(async () =>
|
||||
{
|
||||
.then(async () => {
|
||||
await logger.debug(`User: ${user.id} added user collection`);
|
||||
})
|
||||
.catch(async (e) =>
|
||||
{
|
||||
.catch(async (e) => {
|
||||
await logger.error(
|
||||
`User: ${user.id} failed to added user collection ${e}`
|
||||
);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
logger.debug(`User: ${user.id} already in user collection`);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
import config from '../../config.json';
|
||||
import logger from '../handlers/logger';
|
||||
import fs from 'fs';
|
||||
import { REST } from '@discordjs/rest';
|
||||
import { Routes } from 'discord-api-types/v9';
|
||||
import config from "../../config.json";
|
||||
import logger from "../handlers/logger";
|
||||
import fs from "fs";
|
||||
import { REST } from "@discordjs/rest";
|
||||
import { Routes } from "discord-api-types/v9";
|
||||
|
||||
export default async () => {
|
||||
const commands = [];
|
||||
const commandFiles = fs.readdirSync('./src/commands');
|
||||
const commandFiles = fs.readdirSync("./src/commands");
|
||||
|
||||
for (const file of commandFiles) {
|
||||
// eslint-disable-next-line import/no-dynamic-require, global-require
|
||||
// eslint-disable-next-line global-require
|
||||
const command = require(`../commands/${file}`);
|
||||
commands.push(command.default.data.toJSON());
|
||||
}
|
||||
|
||||
const rest = new REST({ version: '9' }).setToken(config.bot.token);
|
||||
const rest = new REST({ version: "9" }).setToken(config.bot.token);
|
||||
|
||||
await rest.put(Routes.applicationCommands(config.bot.clientId), {
|
||||
body: commands,
|
||||
|
@ -32,7 +32,7 @@ export default async () => {
|
|||
}
|
||||
)
|
||||
.then(async () =>
|
||||
logger.info('Successfully registered application commands.')
|
||||
logger.info("Successfully registered application commands.")
|
||||
)
|
||||
.catch(async (err) => {
|
||||
await logger.error(err);
|
||||
|
|
|
@ -8,7 +8,6 @@ import timeouts from "../helpers/database/models/timeoutSchema";
|
|||
import logger from "../handlers/logger";
|
||||
|
||||
import { Guild } from "discord.js";
|
||||
import updatePresence from "../helpers/updatePresence";
|
||||
|
||||
export default async (guild: Guild) => {
|
||||
guilds
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
import database from "./database";
|
||||
import deployCommands from "./deployCommands";
|
||||
import dbGuildFix from "./dbGuildFix";
|
||||
import dbMemberFix from "./dbMemberFix";
|
||||
|
||||
export default { database, deployCommands, dbGuildFix, dbMemberFix };
|
|
@ -1,28 +1,39 @@
|
|||
import sleep from './sleep';
|
||||
import logger from '../handlers/logger';
|
||||
import sleep from "./sleep";
|
||||
import logger from "../handlers/logger";
|
||||
import Chance from "chance";
|
||||
|
||||
export default async function saveUser(data: any, data2: any) {
|
||||
process.nextTick(
|
||||
async () => {
|
||||
await sleep(Math.floor(Math.random() * 10 + 1) * 100); // 100 - 1000 random Number generator
|
||||
// Chance module
|
||||
const chance = new Chance();
|
||||
|
||||
await sleep(
|
||||
chance.integer({
|
||||
min: 0,
|
||||
max: 1,
|
||||
}) *
|
||||
10 +
|
||||
1 * 100
|
||||
); // 100 - 1000 random Number generator
|
||||
data.save((_: any) =>
|
||||
_
|
||||
? logger.error(
|
||||
`ERROR Occurred while saving data (saveUser) \n${'='.repeat(
|
||||
`ERROR Occurred while saving data (saveUser) \n${"=".repeat(
|
||||
50
|
||||
)}\n${`${_}\n${'='.repeat(50)}`}`
|
||||
)}\n${`${_}\n${"=".repeat(50)}`}`
|
||||
)
|
||||
: 'No Error'
|
||||
: "No Error"
|
||||
);
|
||||
if (data2) {
|
||||
data2.save((_: any) =>
|
||||
_
|
||||
? logger.error(
|
||||
`ERROR Occurred while saving data (saveUser) \n${'='.repeat(
|
||||
`ERROR Occurred while saving data (saveUser) \n${"=".repeat(
|
||||
50
|
||||
)}\n${`${_}\n${'='.repeat(50)}`}`
|
||||
)}\n${`${_}\n${"=".repeat(50)}`}`
|
||||
)
|
||||
: 'No Error'
|
||||
: "No Error"
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue