Merge branch 'dev' into dev

This commit is contained in:
Axel Olausson Holtenäs 2022-05-20 17:41:09 +02:00 committed by GitHub
commit dec900ae29
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 190 additions and 140 deletions

16
.deepsource.toml Normal file
View file

@ -0,0 +1,16 @@
version = 1
[[analyzers]]
name = "javascript"
enabled = true
[[analyzers]]
name = "shell"
enabled = true
[[transformers]]
name = "standardjs"
enabled = true
[[transformers]]
name = "prettier"

View file

@ -7,54 +7,50 @@ This document entails the privacy policy and agreement that you accept when addi
This privacy policy applies to **Xyter**#7721 (949998000401436673)
### Terminology
* **Server Manager** - Anyone who has the ability to add a bot to a server or configure the bot for the server. This is usually an administrator or moderator
* **Server Member** - Anyone who is a member of server to which one of the bots has been added
* **Service User** - Anyone who authorizes an application (logs in) for a scope that provides additional information
- **Server Manager** - Anyone who has the ability to add a bot to a server or configure the bot for the server. This is usually an administrator or moderator
- **Server Member** - Anyone who is a member of server to which one of the bots has been added
- **Service User** - Anyone who authorizes an application (logs in) for a scope that provides additional information
### Data Collected By Command
The following items may be collected and stored when intentionally provided by a user (usually by means of a command). This data will not be collected automatically. When providing data in this way, you forego any rights to the content of the data provided.
* Server configurations (/settings guild)
* Data and content for automated tasks (/shop roles)
* Locale (/settings user language)
* Reputation (/reputation give)
The following items may be collected and stored when intentionally provided by a user (usually by means of a command). This data will not be collected automatically. When providing data in this way, you forego any rights to the content of the data provided.
- Server configurations (/settings guild)
- Data and content for automated tasks (/shop roles)
- Locale (/settings user language)
- Reputation (/reputation give)
### Data Collected When Enabled
These items will be automatically collected if a bot is configured to perform certain actions by a server manager. These features are always opt-in, and thus this data will not be collected unless the corresponding feature is enabled.
* API Token & URL (/settings guild pterodactyl)
* Counters (/admin counter)
- API Token & URL (/settings guild pterodactyl)
- Counters (/admin counter)
### Data Collected Automatically
This data may be collected automatically. This data is used to provide statistics or history data. For any bots that collect this data, it is necessary for features of said bot.
* Username ID (Unique identifier)
* Guild ID (Unique identifier)
* Any data needed for standard operation of Discord bots, such as server permissions
* Credits (/profile view)
* Points (/profile view)
* Levels (/profile view)
* Timestamps (Audit logs and all your data that we store)
- Username ID (Unique identifier)
- Guild ID (Unique identifier)
- Any data needed for standard operation of Discord bots, such as server permissions
- Credits (/profile view)
- Points (/profile view)
- Levels (/profile view)
- Timestamps (Audit logs and all your data that we store)
### Data Storage
All stored data is kept on protected servers. While storage methods vary, most data is kept within password-protected databases such as [MongoDB Atlas](https://atlas.mongodb.com/). Please keep in mind that even with these protections, no data can ever be 100% secure. All efforts are taken to keep your data secure and private, but its absolute security cannot be guaranteed.
### Feedback
Feedback on Xyter bot and service is appreciated. When you submit comments, suggestions, bug reports, and any other forms of feedback, you forego any rights to the content, title, or intent of the provided feedback. Additionally, the feedback may be utilized in any way.
### Agreement
By adding Xyter bot to your server or using this bot or service in any way, you are consenting to the policies outlined in this document. In addition, you (the server manager) are agreeing to inform your members of the [Developer Terms of Service](https://discordapp.com/developers/docs/legal) and the contents of this document. If you, the server manager, do not agree to this document, you may remove the bot(s) from the server. If you, the server member, do not agree to this document, you may leave the server that contains the bot(s). If you, the service user, do not agree to this document, you may revoke authorization of the application(s) in your 'Authorized Apps' menu.
Changes to This Privacy Policy

View file

@ -8,6 +8,7 @@
<div align=center>
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/3d9f95c4a4814a2297142448c6646f60)](https://app.codacy.com/gh/ZynerOrg/xyter?utm_source=github.com&utm_medium=referral&utm_content=ZynerOrg/xyter&utm_campaign=Badge_Grade_Settings)
[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=ZynerOrg_xyter&metric=ncloc)](https://sonarcloud.io/dashboard?id=ZynerOrg_xyter)
[![CodeFactor](https://www.codefactor.io/repository/github/ZynerOrg/xyter/badge/main)](https://www.codefactor.io/repository/github/ZynerOrg/xyter/overview/main)

View file

@ -2,10 +2,10 @@
## Supported Versions
| Version | Supported |
| ------- | ------------------ |
| Version | Supported |
| ---------- | ------------------ |
| 2022.4.x | :white_check_mark: |
| < 2022.4.x | :x: |
| < 2022.4.x | :x: |
## Reporting a Vulnerability

View file

@ -27,11 +27,10 @@
"email": "vermium@zyner.org"
},
"dependencies": {
"@crowdin/ota-client": "^0.7.0",
"@discordjs/builders": "^0.13.0",
"@discordjs/rest": "^0.4.0",
"@types/i18next-fs-backend": "^1.1.2",
"axios": "^0.27.0",
"axios": "^0.27.2",
"chance": "^1.1.8",
"common": "^0.2.5",
"crypto": "^1.0.1",

View file

@ -4,7 +4,7 @@ import { secretKey, algorithm } from "@config/encryption";
const iv = crypto.randomBytes(16);
const encrypt = (text: any) => {
const encrypt = (text: any): { iv: error; content: error } => {
const cipher = crypto.createCipheriv(algorithm, secretKey, iv);
const encrypted = Buffer.concat([cipher.update(text), cipher.final()]);

View file

@ -1,6 +1,6 @@
import logger from "@root/logger";
export default (count: number, noun: string, suffix?: string) => {
export default (count: number, noun: string, suffix?: string): string => {
const result = `${count} ${noun}${count !== 1 ? suffix || "s" : ""}`;
logger?.silly(`Pluralized ${count} to ${result}`);
return result;

View file

@ -9,18 +9,51 @@ import schedules from "@handlers/schedules";
import events from "@handlers/events";
import commands from "@handlers/commands";
// Main process that starts all other sub processes
const main = async () => {
// Initiate client object
const client = new Client({
intents,
});
await database();
await schedules(client);
// Start database manager
await database()
.then(async () => {
await logger.silly("Database process started");
})
.catch(async (err) => {
await logger.error(`${err}`);
});
await commands(client);
await events(client);
// Start schedule manager
await schedules(client)
.then(async () => {
await logger.silly("Schedules process started");
})
.catch(async (err) => {
await logger.error(`${err}`);
});
// Start command handler
await commands(client)
.then(async () => {
await logger.silly("Commands process started");
})
.catch(async (err) => {
await logger.error(`${err}`);
});
// Start event handler
await events(client)
.then(async () => {
await logger.silly("Events process started");
})
.catch(async (err) => {
await logger.error(`${err}`);
});
// Authorize with Discord's API
await client.login(token);
};
main();
main()

View file

@ -3,24 +3,31 @@ import "winston-daily-rotate-file";
const { combine, timestamp, printf, colorize, align, json } = winston.format;
export default winston.createLogger({
level: process.env.LOG_LEVEL || "silly",
transports: [
new winston.transports.DailyRotateFile({
filename: "logs/combined-%DATE%.log",
datePattern: "YYYY-MM-DD",
maxFiles: "14d",
format: combine(timestamp(), json()),
}),
new winston.transports.Console({
format: combine(
colorize({ all: true }),
timestamp({
format: "YYYY-MM-DD HH:MM:ss",
module.exports = {
// Logger initialized async-hronously
logger: async () => {
return winston.createLogger({
level: process.env.LOG_LEVEL || "silly",
transports: [
new winston.transports.DailyRotateFile({
filename: "logs/combined-%DATE%.log",
datePattern: "YYYY-MM-DD",
maxFiles: "14d",
format: combine(timestamp(), json()),
}),
align(),
printf((info) => `[${info.timestamp}] ${info.level}: ${info.message}`)
),
}),
],
});
new winston.transports.Console({
format: combine(
colorize({ all: true }),
timestamp({
format: "YYYY-MM-DD HH:MM:ss",
}),
align(),
printf(
(info) => `[${info.timestamp}] ${info.level}: ${info.message}`
)
),
}),
],
});
},
};

View file

@ -1,12 +1,10 @@
import axios from "axios";
import { CommandInteraction, MessageEmbed } from "discord.js";
import { CommandInteraction } from "discord.js";
import getEmbedConfig from "@helpers/getEmbedConfig";
import { SlashCommandSubcommandBuilder } from "@discordjs/builders";
import logger from "@logger";
import embedBuilder from "@root/helpers/embedBuilder";
export default {