From 2cdc3545c9c1396429e70f2c3a7896ee38f78efe Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Fri, 19 Nov 2021 20:35:23 -0500
Subject: [PATCH 01/21] moved commands and events (WIP)
---
{commands => server/commands}/announcement.js | 0
{commands => server/commands}/embed.js | 0
{commands => server/commands}/identifiers.js | 0
{commands => server/commands}/kick.js | 0
{commands => server/commands}/kickall.js | 0
{commands => server/commands}/kill.js | 0
{commands => server/commands}/message.js | 0
{commands => server/commands}/onlinecount.js | 0
{commands => server/commands}/players.js | 0
{commands => server/commands}/qb-ban.js | 0
{commands => server/commands}/qb-clothingmenu.js | 0
{commands => server/commands}/qb-gang.js | 0
{commands => server/commands}/qb-inventory.js | 0
{commands => server/commands}/qb-jail.js | 0
{commands => server/commands}/qb-job.js | 10 ++++++++++
{commands => server/commands}/qb-logout.js | 0
{commands => server/commands}/qb-money.js | 0
{commands => server/commands}/qb-permissions.js | 0
{commands => server/commands}/qb-revive.js | 0
{commands => server/commands}/qb-reviveall.js | 0
{commands => server/commands}/qb-time.js | 0
{commands => server/commands}/qb-weather.js | 0
{commands => server/commands}/resource.js | 0
{commands => server/commands}/screenshot.js | 2 +-
{commands => server/commands}/server.js | 14 +++++++-------
{commands => server/commands}/teleport.js | 0
{commands => server/commands}/teleportall.js | 0
{events => server/events}/interactionCreate.js | 0
{events => server/events}/messageCreate.js | 15 +++++++++++----
{events => server/events}/ready.js | 8 ++++----
30 files changed, 33 insertions(+), 16 deletions(-)
rename {commands => server/commands}/announcement.js (100%)
rename {commands => server/commands}/embed.js (100%)
rename {commands => server/commands}/identifiers.js (100%)
rename {commands => server/commands}/kick.js (100%)
rename {commands => server/commands}/kickall.js (100%)
rename {commands => server/commands}/kill.js (100%)
rename {commands => server/commands}/message.js (100%)
rename {commands => server/commands}/onlinecount.js (100%)
rename {commands => server/commands}/players.js (100%)
rename {commands => server/commands}/qb-ban.js (100%)
rename {commands => server/commands}/qb-clothingmenu.js (100%)
rename {commands => server/commands}/qb-gang.js (100%)
rename {commands => server/commands}/qb-inventory.js (100%)
rename {commands => server/commands}/qb-jail.js (100%)
rename {commands => server/commands}/qb-job.js (89%)
rename {commands => server/commands}/qb-logout.js (100%)
rename {commands => server/commands}/qb-money.js (100%)
rename {commands => server/commands}/qb-permissions.js (100%)
rename {commands => server/commands}/qb-revive.js (100%)
rename {commands => server/commands}/qb-reviveall.js (100%)
rename {commands => server/commands}/qb-time.js (100%)
rename {commands => server/commands}/qb-weather.js (100%)
rename {commands => server/commands}/resource.js (100%)
rename {commands => server/commands}/screenshot.js (98%)
rename {commands => server/commands}/server.js (85%)
rename {commands => server/commands}/teleport.js (100%)
rename {commands => server/commands}/teleportall.js (100%)
rename {events => server/events}/interactionCreate.js (100%)
rename {events => server/events}/messageCreate.js (56%)
rename {events => server/events}/ready.js (87%)
diff --git a/commands/announcement.js b/server/commands/announcement.js
similarity index 100%
rename from commands/announcement.js
rename to server/commands/announcement.js
diff --git a/commands/embed.js b/server/commands/embed.js
similarity index 100%
rename from commands/embed.js
rename to server/commands/embed.js
diff --git a/commands/identifiers.js b/server/commands/identifiers.js
similarity index 100%
rename from commands/identifiers.js
rename to server/commands/identifiers.js
diff --git a/commands/kick.js b/server/commands/kick.js
similarity index 100%
rename from commands/kick.js
rename to server/commands/kick.js
diff --git a/commands/kickall.js b/server/commands/kickall.js
similarity index 100%
rename from commands/kickall.js
rename to server/commands/kickall.js
diff --git a/commands/kill.js b/server/commands/kill.js
similarity index 100%
rename from commands/kill.js
rename to server/commands/kill.js
diff --git a/commands/message.js b/server/commands/message.js
similarity index 100%
rename from commands/message.js
rename to server/commands/message.js
diff --git a/commands/onlinecount.js b/server/commands/onlinecount.js
similarity index 100%
rename from commands/onlinecount.js
rename to server/commands/onlinecount.js
diff --git a/commands/players.js b/server/commands/players.js
similarity index 100%
rename from commands/players.js
rename to server/commands/players.js
diff --git a/commands/qb-ban.js b/server/commands/qb-ban.js
similarity index 100%
rename from commands/qb-ban.js
rename to server/commands/qb-ban.js
diff --git a/commands/qb-clothingmenu.js b/server/commands/qb-clothingmenu.js
similarity index 100%
rename from commands/qb-clothingmenu.js
rename to server/commands/qb-clothingmenu.js
diff --git a/commands/qb-gang.js b/server/commands/qb-gang.js
similarity index 100%
rename from commands/qb-gang.js
rename to server/commands/qb-gang.js
diff --git a/commands/qb-inventory.js b/server/commands/qb-inventory.js
similarity index 100%
rename from commands/qb-inventory.js
rename to server/commands/qb-inventory.js
diff --git a/commands/qb-jail.js b/server/commands/qb-jail.js
similarity index 100%
rename from commands/qb-jail.js
rename to server/commands/qb-jail.js
diff --git a/commands/qb-job.js b/server/commands/qb-job.js
similarity index 89%
rename from commands/qb-job.js
rename to server/commands/qb-job.js
index 996d3b0..cc3c451 100644
--- a/commands/qb-job.js
+++ b/server/commands/qb-job.js
@@ -63,6 +63,16 @@ module.exports = {
{ name: "Grade 8", value: "8" },
{ name: "Grade 9", value: "9" },
{ name: "Grade 10", value: "10" },
+ { name: "Grade 11", value: "11" },
+ { name: "Grade 12", value: "12" },
+ { name: "Grade 13", value: "13" },
+ { name: "Grade 14", value: "14" },
+ { name: "Grade 15", value: "15" },
+ { name: "Grade 16", value: "16" },
+ { name: "Grade 17", value: "17" },
+ { name: "Grade 18", value: "18" },
+ { name: "Grade 19", value: "19" },
+ { name: "Grade 20", value: "20" },
],
},
],
diff --git a/commands/qb-logout.js b/server/commands/qb-logout.js
similarity index 100%
rename from commands/qb-logout.js
rename to server/commands/qb-logout.js
diff --git a/commands/qb-money.js b/server/commands/qb-money.js
similarity index 100%
rename from commands/qb-money.js
rename to server/commands/qb-money.js
diff --git a/commands/qb-permissions.js b/server/commands/qb-permissions.js
similarity index 100%
rename from commands/qb-permissions.js
rename to server/commands/qb-permissions.js
diff --git a/commands/qb-revive.js b/server/commands/qb-revive.js
similarity index 100%
rename from commands/qb-revive.js
rename to server/commands/qb-revive.js
diff --git a/commands/qb-reviveall.js b/server/commands/qb-reviveall.js
similarity index 100%
rename from commands/qb-reviveall.js
rename to server/commands/qb-reviveall.js
diff --git a/commands/qb-time.js b/server/commands/qb-time.js
similarity index 100%
rename from commands/qb-time.js
rename to server/commands/qb-time.js
diff --git a/commands/qb-weather.js b/server/commands/qb-weather.js
similarity index 100%
rename from commands/qb-weather.js
rename to server/commands/qb-weather.js
diff --git a/commands/resource.js b/server/commands/resource.js
similarity index 100%
rename from commands/resource.js
rename to server/commands/resource.js
diff --git a/commands/screenshot.js b/server/commands/screenshot.js
similarity index 98%
rename from commands/screenshot.js
rename to server/commands/screenshot.js
index 09dfd24..040cdf6 100644
--- a/commands/screenshot.js
+++ b/server/commands/screenshot.js
@@ -53,7 +53,7 @@ module.exports = {
.setImage(`attachment://${name}`)
.setFooter(`Taken At ${client.utils.log.timestamp()}`);
await interaction.editReply({ content: null, embeds: [ embed ], files: [ { attachment: buffer, name: name } ] }).catch(console.error);
- if (client.config.saveScreenshots) {
+ if (client.config.SaveScreenshotsToServer) {
await fs.mkdir(`${client.root}/screenshots`, { recursive: true }).catch();
await fs.writeFile(`${client.root}/screenshots/${name}`, data, { encoding: "base64", flag:"w+" }).catch(client.utils.log.error);
}
diff --git a/commands/server.js b/server/commands/server.js
similarity index 85%
rename from commands/server.js
rename to server/commands/server.js
index 99062e2..c045100 100644
--- a/commands/server.js
+++ b/server/commands/server.js
@@ -25,12 +25,12 @@ module.exports = {
// role: "mod",
run: async (client, interaction) => {
- if (client.utils.isRolePresent(client, interaction.member, [client.config.modRole, client.config.adminRole, client.config.godRole])) {
+ if (client.utils.isRolePresent(client, interaction.member, [client.config.DiscordModRoleId, client.config.DiscordAdminRoleId, client.config.DiscordGodRoleId])) {
const embed = new client.Embed()
.setThumbnail(interaction.guild.iconURL({ format: "png", size: 512 }))
.addField("FiveM Server:", `**Version:** ${GetConvar("version", "Unknown")}
- **Server Name:** ${client.config.serverName}
- **Server IP:** ${client.config.serverIp}
+ **Server Name:** ${client.config.FiveMServerName}
+ **Server IP:** ${client.config.FiveMServerIP}
**Resource Count:** ${GetNumResources()}
**Game Build:** ${GetConvar("sv_enforceGameBuild", "Unknown")}
**Max Clients:** ${GetConvar("sv_maxClients", "Unknown")}
@@ -38,7 +38,7 @@ module.exports = {
**Uptime:** ${(GetGameTimer() / 1000 / 60).toFixed(2)} minutes
**Online Players:** ${GetNumPlayerIndices()}`, false)
.addField("Discord Server:", `**ID:** ${interaction.guildId}
- **Invite:** ${client.config.discordInvite}
+ **Invite:** ${client.config.DiscordInviteLink}
**Roles:** ${interaction.guild.roles.cache.size}
**Channels:** ${interaction.guild.channels.cache.filter((chan) => chan.type === "GUILD_TEXT").size}
**Members:** ${interaction.guild.memberCount}${getWhitelisted(client, interaction)}
@@ -48,7 +48,7 @@ module.exports = {
} else {
const embed = new client.Embed()
.setThumbnail(interaction.guild.iconURL({ format: "png", size: 512 }))
- .addField(client.config.serverName, `**Server IP:** ${client.config.serverIp}
+ .addField(client.config.FiveMServerName, `**Server IP:** ${client.config.FiveMServerIP}
**Uptime:** ${(GetGameTimer() / 1000 / 60).toFixed(2)} minutes
**Players:** ${GetNumPlayerIndices()}/${GetConvar("sv_maxClients", "Unknown")}`, false)
.setFooter(`${GetCurrentResourceName()} by zfbx`);
@@ -59,10 +59,10 @@ module.exports = {
function getWhitelisted(client, interaction) {
- if (!client.config.enableWhitelist) return "";
+ if (!client.config.EnableWhitelistChecking) return "";
const membersWithRole = interaction.guild.members.cache.filter(member => {
let found = false;
- client.config.whitelistRoles.forEach(role => {
+ client.config.DiscordWhitelistRoleIds.forEach(role => {
if (member.roles.cache.has(role)) found = true;
});
return found;
diff --git a/commands/teleport.js b/server/commands/teleport.js
similarity index 100%
rename from commands/teleport.js
rename to server/commands/teleport.js
diff --git a/commands/teleportall.js b/server/commands/teleportall.js
similarity index 100%
rename from commands/teleportall.js
rename to server/commands/teleportall.js
diff --git a/events/interactionCreate.js b/server/events/interactionCreate.js
similarity index 100%
rename from events/interactionCreate.js
rename to server/events/interactionCreate.js
diff --git a/events/messageCreate.js b/server/events/messageCreate.js
similarity index 56%
rename from events/messageCreate.js
rename to server/events/messageCreate.js
index e8f387a..8ccbd06 100644
--- a/events/messageCreate.js
+++ b/server/events/messageCreate.js
@@ -21,9 +21,16 @@ module.exports = {
name: "messageCreate",
// msg = https://discord.js.org/#/docs/main/stable/class/Message
run: async (client, msg) => {
- /**
- * Currently this does nothing but in the future this could be used to grab messages
- * from a certain channel and forward them to staff in city for communication between mods
- */
+ if (!msg.content || !client.QBCore || msg.author.bot) return;
+ if (client.config.EnableStaffChatForwarding && msg.channel.id == client.config.DiscordStaffChannelId) {
+ getPlayers().forEach(async function(player, index, array) {
+ if (IsPlayerAceAllowed(player, "zdiscord.staffchat") && !staffChatDisabled[player]) {
+ emitNet("chat:addMessage", player, {
+ template: `
[staff] ${msg.member.displayName}: ${msg.content}
`,
+ });
+ }
+ });
+ return console.log(`[STAFF] ${msg.member.displayName}: ${msg.content}`);
+ }
},
};
diff --git a/events/ready.js b/server/events/ready.js
similarity index 87%
rename from events/ready.js
rename to server/events/ready.js
index d089b02..f55d477 100644
--- a/events/ready.js
+++ b/server/events/ready.js
@@ -21,8 +21,8 @@ module.exports = {
name: "ready",
once: true,
run: async (client) => {
- if (config.enableCommands) {
- const guild = client.guilds.cache.get(client.config.guildid);
+ if (config.EnableDiscordSlashCommands) {
+ const guild = client.guilds.cache.get(client.config.DiscordGuildId);
if (!guild) return client.utils.log.error("DISCORD SERVER NOT FOUND - Is your config for 'DiscordGuildId' set correctly?");
await guild.commands.set(client.arrayOfCommands).catch((error) => client.utils.log.handler("error", error)).then((cmd) => {
const fullPermissions = cmd.reduce((accumulator, x) => {
@@ -37,7 +37,7 @@ module.exports = {
guild.commands.permissions.set({ fullPermissions }).catch((error) => client.utils.log.handler("error", error));
});
}
- if (config.enableStatus && config.statusMessages) statusUpdater(client);
+ if (config.EnableBotStatusMessages && config.BotStatusMessages) statusUpdater(client);
client.utils.log.info(`Logged in as ${client.user.tag}`);
},
};
@@ -45,7 +45,7 @@ module.exports = {
async function statusUpdater(client) {
setInterval(function() {
try {
- const msg = client.utils.replaceGlobals(config.statusMessages[Math.floor(Math.random() * config.statusMessages.length)]);
+ const msg = client.utils.replaceGlobals(config.BotStatusMessages[Math.floor(Math.random() * config.BotStatusMessages.length)]);
client.user.setActivity({ name: msg, type: "PLAYING" });
} catch (e) {
// Just gonna void these errors..
From f4cd61e32d8679b62da1568474536167c311e17c Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Fri, 19 Nov 2021 20:38:04 -0500
Subject: [PATCH 02/21] sorted client and server to folder plus bumped version
---
.vscode/settings.json | 3 -
client.lua => client/client.lua | 2 -
fxmanifest.lua | 6 +-
package.json | 162 ++++++++++++++++++---------
readme.md | 2 +-
server.js | 166 ----------------------------
server/bot.js | 93 ++++++++++++++++
server/server.js | 189 ++++++++++++++++++++++++++++++++
utils.js => server/utils.js | 22 +++-
9 files changed, 416 insertions(+), 229 deletions(-)
rename client.lua => client/client.lua (89%)
delete mode 100644 server.js
create mode 100644 server/bot.js
create mode 100644 server/server.js
rename utils.js => server/utils.js (94%)
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 6e88373..5c8c298 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -23,7 +23,6 @@
"SetEntityCoords"
],
"cSpell.words": [
- "aceperms",
"alloc",
"bannedby",
"bantime",
@@ -37,12 +36,10 @@
"Dabbzz",
"Deutsch",
"discordinvite",
- "enableaceperms",
"EXTRASUNNY",
"firstname",
"fivem",
"fxmanifest",
- "guildid",
"injail",
"isdst",
"kickall",
diff --git a/client.lua b/client/client.lua
similarity index 89%
rename from client.lua
rename to client/client.lua
index 52e2545..26cd1ef 100644
--- a/client.lua
+++ b/client/client.lua
@@ -31,5 +31,3 @@ RegisterNetEvent(GetCurrentResourceName()..':teleport', function(x, y, z, withVe
SetEntityCoords(PlayerPedId(), x, y, z);
end
end)
-
--- Add staff reply command? (reply to the same channel that a message was sent to the player from or default to a reports channel?)
diff --git a/fxmanifest.lua b/fxmanifest.lua
index 6002551..998390f 100644
--- a/fxmanifest.lua
+++ b/fxmanifest.lua
@@ -23,12 +23,12 @@ games { "gta5" }
author "zfbx"
description "Discord bot allowlist and more"
repository "https://github.com/zfbx/zdiscord"
-version "6.0.0"
+version "7.0.0"
license "GPLv3"
lua54 'yes'
-server_script "server.js"
-client_script "client.lua"
+server_script "server/server.js"
+client_script "client/client.lua"
dependencies {
'/server:4800', -- Node16+
diff --git a/package.json b/package.json
index 5a63fae..9528b9e 100644
--- a/package.json
+++ b/package.json
@@ -1,10 +1,10 @@
{
"name": "zdiscord",
- "version": "6.0.0",
+ "version": "7.0.0",
"description": "Simple Discord Bot Allowlist",
"main": "server.js",
"scripts": {
- "start": "node server.mjs"
+ "start": "node server/server.js"
},
"repository": {
"type": "git",
@@ -20,57 +20,117 @@
},
"homepage": "https://github.com/zfbx/zdiscord",
"dependencies": {
- "discord.js": "zfbx/discord.js"
+ "discord.js": "zfbx/discord.js",
+ "node-fetch": "^2.6.6"
},
"eslintConfig": {
"extends": "eslint:recommended",
- "env": {
- "node": true,
- "es6": true
- },
- "parserOptions": {
- "ecmaVersion": 2021,
- "sourceType": "script"
- },
- "rules": {
- "arrow-spacing": ["warn", { "before": true, "after": true }],
- "comma-dangle": ["error", "always-multiline"],
- "comma-spacing": "error",
- "comma-style": "error",
- "curly": ["error", "multi-line", "consistent"],
- "dot-location": ["error", "property"],
- "handle-callback-err": "off",
- "indent": ["error", 4],
- "keyword-spacing": "error",
- "max-nested-callbacks": ["error", { "max": 4 }],
- "max-statements-per-line": ["error", { "max": 2 }],
- "no-console": "off",
- "no-empty-function": "error",
- "no-floating-decimal": "error",
- "no-inline-comments": "error",
- "no-lonely-if": "error",
- "no-multi-spaces": "error",
- "no-multiple-empty-lines": ["error", { "max": 2, "maxEOF": 1, "maxBOF": 0 }],
- "no-shadow": ["error", { "allow": ["err", "resolve", "reject"] }],
- "no-trailing-spaces": ["error"],
- "no-var": "error",
- "object-curly-spacing": ["error", "always"],
- "prefer-const": "error",
- "quotes": ["error", "double"],
- "semi": ["error", "always"],
- "space-before-blocks": "error",
- "space-before-function-paren": ["error", {
- "anonymous": "never",
- "named": "never",
- "asyncArrow": "always"
- }],
- "space-in-parens": "error",
- "space-infix-ops": "error",
- "space-unary-ops": "error",
- "spaced-comment": "error",
- "yoda": "error",
- "no-undef": "off",
- "no-unused-vars": "off"
- }
+ "env": {
+ "node": true,
+ "es6": true
+ },
+ "parserOptions": {
+ "ecmaVersion": 2021,
+ "sourceType": "script"
+ },
+ "rules": {
+ "arrow-spacing": [
+ "warn",
+ {
+ "before": true,
+ "after": true
+ }
+ ],
+ "comma-dangle": [
+ "error",
+ "always-multiline"
+ ],
+ "comma-spacing": "error",
+ "comma-style": "error",
+ "curly": [
+ "error",
+ "multi-line",
+ "consistent"
+ ],
+ "dot-location": [
+ "error",
+ "property"
+ ],
+ "handle-callback-err": "off",
+ "indent": [
+ "error",
+ 4
+ ],
+ "keyword-spacing": "error",
+ "max-nested-callbacks": [
+ "error",
+ {
+ "max": 4
+ }
+ ],
+ "max-statements-per-line": [
+ "error",
+ {
+ "max": 2
+ }
+ ],
+ "no-console": "off",
+ "no-empty-function": "error",
+ "no-floating-decimal": "error",
+ "no-inline-comments": "error",
+ "no-lonely-if": "error",
+ "no-multi-spaces": "error",
+ "no-multiple-empty-lines": [
+ "error",
+ {
+ "max": 3,
+ "maxEOF": 1,
+ "maxBOF": 0
+ }
+ ],
+ "no-shadow": [
+ "error",
+ {
+ "allow": [
+ "err",
+ "resolve",
+ "reject"
+ ]
+ }
+ ],
+ "no-trailing-spaces": [
+ "error"
+ ],
+ "no-var": "error",
+ "object-curly-spacing": [
+ "error",
+ "always"
+ ],
+ "prefer-const": "error",
+ "quotes": [
+ "error",
+ "double"
+ ],
+ "semi": [
+ "error",
+ "always"
+ ],
+ "space-before-blocks": "error",
+ "space-before-function-paren": [
+ "error",
+ {
+ "anonymous": "never",
+ "named": "never",
+ "asyncArrow": "always"
+ }
+ ],
+ "space-in-parens": "error",
+ "space-infix-ops": "error",
+ "space-unary-ops": "error",
+ "spaced-comment": "error",
+ "yoda": "error",
+ "no-undef": "off",
+ "no-unused-vars": "off"
+ }
}
}
diff --git a/readme.md b/readme.md
index b713b58..73052b9 100644
--- a/readme.md
+++ b/readme.md
@@ -1,4 +1,4 @@
-# zdiscord (v5)
+# zdiscord (v7)
**Note: This version of zdiscord REQUIRES FiveM artifacts 4800 or newer, if you're running an earlier version you might want to checkout the [v4 eris branch](https://github.com/zfbx/zdiscord/tree/eris) instead**
diff --git a/server.js b/server.js
deleted file mode 100644
index fa56957..0000000
--- a/server.js
+++ /dev/null
@@ -1,166 +0,0 @@
-/**
- * This file is part of zdiscord.
- * Copyright (C) 2021 Tony/zfbx
- * source:
- *
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
- */
-
-/**
- * DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU'RE DOING OR ARE
- * SUGGESTED TO DO SO BY SOMEONE WHO DOES. <3
- */
-const root = GetResourcePath(GetCurrentResourceName());
-const config = require(`${root}/config.js`);
-const utils = require("./utils.js");
-loadDiscordPermissions();
-// Sanity checks
-utils.log.assert((process.version == "v12.13.0"), `You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of ${GetCurrentResourceName()}`);
-utils.log.assert((config.token == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
-utils.log.assert((config.guildid == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
-utils.log.assert(!(utils.isValidID(config.guildid)), "Your DiscordGuildId doesn't seem correct");
-utils.log.assert(!(utils.isValidID(config.modRole)), "Your DiscordModRoleId doesn't seem correct");
-utils.log.assert(!(utils.isValidID(config.adminRole)), "Your DiscordAdminRoleId doesn't seem correct");
-utils.log.assert(!(utils.isValidID(config.godRole)), "Your DiscordGodRoleId doesn't seem correct");
-utils.log.assert(!(utils.isValidID(config.staffChannel)), "Your DiscordStaffChannelId doesn't seem correct");
-// Set public values so client can see them
-SetConvarReplicated("zdiscord_servername", config.serverName);
-SetConvarReplicated("zdiscord_discordinvite", config.discordInvite);
-SetConvarReplicated("zdiscord_serverip", config.serverIp);
-SetConvarReplicated("zdiscord_userpresence", config.enableUserPresence.toString());
-
-
-const { Client, Collection, MessageEmbed } = require("discord.js");
-const locale = require("./locales/" + config.lang);
-const { readdirSync } = require("fs");
-
-const client = new Client({
- intents: 14335,
- fetchAllMembers: true,
- messageCacheMaxSize: 10,
-});
-
-try {
- client.QBCore = global.exports["qb-core"].GetCoreObject();
- if (client.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
-} catch { client.QBCore = false; }
-
-client.root = root;
-client.utils = utils;
-client.config = config;
-client.locale = locale;
-client.Embed = MessageEmbed;
-
-client.commands = new Collection();
-client.arrayOfCommands = [];
-if (config.enableCommands) {
- const commandFiles = readdirSync(`${root}/commands`).filter(file => file.endsWith(".js"));
- for (const file of commandFiles) {
- const command = require(`${root}/commands/${file}`);
- if (!command?.name) continue;
- if (command.args || command.alias) {
- utils.log.warn(`${file} is an v4 or later command and is not supported, upgrade it or remove it`);
- continue;
- }
- if (!command.version || command.version < 6) {
- utils.log.warn(`${file} is an outdated command - check the github for updated commands`);
- continue;
- }
- if (client.commands.has(command.name)) {
- utils.log.warn(`${file} is using a name that's already been registered by another command [skipping]`);
- continue;
- }
- if (file.startsWith("qb-") && !client.QBCore) continue;
- client.commands.set(command.name, command);
- if (["MESSAGE", "USER"].includes(command.type)) delete command.description;
- client.arrayOfCommands.push(command);
- }
-}
-
-const eventFiles = readdirSync(`${root}/events`).filter(file => file.endsWith(".js"));
-for (const file of eventFiles) {
- const event = require(`${root}/events/${file}`);
- if (event.once) client.once(event.name, (...args) => event.run(client, ...args));
- else client.on(event.name, (...args) => event.run(client, ...args));
-}
-
-// Uncomment for discord.js debugging
-// client.on("debug", (debug) => client.utils.log.handler("log", debug));
-client.on("warn", (warning) => client.utils.log.handler("warn", warning));
-client.on("error", (error) => client.utils.log.handler("error", error));
-
-client.login(config.token).catch((e) => client.utils.log.handler("error", e));
-
-on("playerConnecting", async (name, setKickReason, deferrals) => {
- if (!config.enableWhitelist) return;
- const player = source;
- deferrals.defer();
- await utils.sleep(0);
- deferrals.update(client.utils.replaceGlobals(locale.checkingWhitelist.replace(/{name}/g, name)));
- await utils.sleep(0);
- const discordID = utils.getPlayerDiscordId(player);
- if (!discordID) return deferrals.done(client.utils.replaceGlobals(locale.discordNotOpen));
- const member = utils.getMember(client, discordID);
- if (!member) return deferrals.done(client.utils.replaceGlobals(locale.notInDiscordServer));
- const whitelisted = utils.isRolePresent(client, member, config.whitelistRoles);
- if (whitelisted) deferrals.done();
- else deferrals.done(client.utils.replaceGlobals(locale.notWhitelisted));
-});
-
-global.exports("isRolePresent", (identifier, role) => {
- return utils.isRolePresent(client, identifier, role);
-});
-
-global.exports("getRoles", (identifier) => {
- return utils.getMemberRoles(client, identifier);
-});
-
-global.exports("getName", (identifier) => {
- const member = utils.parseMember(client, identifier);
- return member.displayName || false;
-});
-
-on("playerJoining", (oldId) => {
- const source = global.source;
- if (config.enableaceperms) {
- const member = utils.getMemberFromSource(client, source);
- for (const [perm, role] of Object.entries(config.aceperms)) {
- if (utils.isRolePresent(client, member, role)) {
- ExecuteCommand(`add_principal "player.${source}" "${perm}"`);
- }
- }
- }
-});
-
-on("playerDropped", (reason) => {
- const source = global.source;
- if (config.enableaceperms) {
- for (const [perm, role] of Object.entries(config.aceperms)) {
- ExecuteCommand(`remove_principal "player.${source}" "${perm}"`);
- }
- }
-});
-
-/** Generates permissions for commands to inherit from */
-function loadDiscordPermissions() {
- const mod = { id: config.modRole, type: 1, permission: true };
- const admin = { id: config.adminRole, type: 1, permission: true };
- const god = { id: config.godRole, type: 1, permission: true };
- const own = { id: "142831624868855808", type: 2, permission: true };
- config.perms = {
- "mod": [ mod, admin, god, own ],
- "admin": [ admin, god, own ],
- "god": [ god, own ],
- };
-}
diff --git a/server/bot.js b/server/bot.js
new file mode 100644
index 0000000..c24f367
--- /dev/null
+++ b/server/bot.js
@@ -0,0 +1,93 @@
+/**
+ * This file is part of zdiscord.
+ * Copyright (C) 2021 Tony/zfbx
+ * source:
+ *
+ * zdiscord is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * zdiscord is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with zdiscord. If not, see .
+ */
+
+console.log(config.languageLocaleCode);
+const { Client, Collection, MessageEmbed } = require("discord.js");
+const { readdirSync } = require("fs");
+
+
+utils.log.assert((process.version == "v12.13.0"), `You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of ${GetCurrentResourceName()}`);
+utils.log.assert((config.DiscordBotToken == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
+utils.log.assert((config.DiscordGuildId == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
+utils.log.assert(!(utils.isValidID(config.DiscordGuildId)), "Your DiscordGuildId doesn't seem correct");
+utils.log.assert(!(utils.isValidID(config.DiscordModRoleId)), "Your DiscordModRoleId doesn't seem correct");
+utils.log.assert(!(utils.isValidID(config.DiscordAdminRoleId)), "Your DiscordAdminRoleId doesn't seem correct");
+utils.log.assert(!(utils.isValidID(config.DiscordGodRoleId)), "Your DiscordGodRoleId doesn't seem correct");
+utils.log.assert(config.EnableStaffChatForwarding && !(utils.isValidID(config.DiscordStaffChannelId)), "Your DiscordStaffChannelId doesn't seem correct");
+
+const client = new Client({
+ intents: 14335,
+ fetchAllMembers: true,
+ messageCacheMaxSize: 10,
+});
+
+client.root = root;
+client.utils = utils;
+client.config = config;
+client.locale = locale;
+client.Embed = MessageEmbed;
+
+try {
+ client.QBCore = global.exports["qb-core"].GetCoreObject();
+ if (client.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
+} catch { client.QBCore = false; }
+
+
+client.commands = new Collection();
+client.arrayOfCommands = [];
+if (config.EnableDiscordSlashCommands) {
+ const commandFiles = readdirSync(`${root}/server/commands`).filter(file => file.endsWith(".js"));
+ for (const file of commandFiles) {
+ const command = require(`${root}/server/commands/${file}`);
+ if (!command?.name) continue;
+ if (command.args || command.alias) {
+ utils.log.warn(`${file} is an v4 or later command and is not supported, upgrade it or remove it`);
+ continue;
+ }
+ if (!command.version || command.version < 6) {
+ utils.log.warn(`${file} is an outdated command - check the github for updated commands`);
+ continue;
+ }
+ if (client.commands.has(command.name)) {
+ utils.log.warn(`${file} is using a name that's already been registered by another command [skipping]`);
+ continue;
+ }
+ if (file.startsWith("qb-") && !client.QBCore) continue;
+ client.commands.set(command.name, command);
+ if (["MESSAGE", "USER"].includes(command.type)) delete command.description;
+ client.arrayOfCommands.push(command);
+ }
+}
+
+const eventFiles = readdirSync(`${root}/server/events`).filter(file => file.endsWith(".js"));
+for (const file of eventFiles) {
+ const event = require(`${root}/server/events/${file}`);
+ if (event.once) client.once(event.name, (...args) => event.run(client, ...args));
+ else client.on(event.name, (...args) => event.run(client, ...args));
+}
+
+// Uncomment for discord.js debugging
+// client.on("debug", (debug) => client.utils.log.handler("log", debug));
+client.on("warn", (warning) => client.utils.log.handler("warn", warning));
+client.on("error", (error) => client.utils.log.handler("error", error));
+
+client.login(config.DiscordBotToken).catch((e) => client.utils.log.handler("error", e));
+
+
+module.exports = client;
diff --git a/server/server.js b/server/server.js
new file mode 100644
index 0000000..eac7b05
--- /dev/null
+++ b/server/server.js
@@ -0,0 +1,189 @@
+/**
+ * This file is part of zdiscord.
+ * Copyright (C) 2021 Tony/zfbx
+ * source:
+ *
+ * zdiscord is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * zdiscord is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with zdiscord. If not, see .
+ */
+
+/**
+ * DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU'RE DOING OR ARE
+ * SUGGESTED TO DO SO BY SOMEONE WHO DOES. <3
+ */
+
+const fetch = require("node-fetch");
+const root = GetResourcePath(GetCurrentResourceName());
+const config = require(`${root}/config.js`);
+const locale = require(`${root}/locales/${config.LanguageLocaleCode}`);
+const utils = require(`${root}/server/utils.js`);
+loadDiscordPermissions();
+
+let bot = false;
+if (config.EnableDiscordBot) bot = require(`${root}/server/bot.js`);
+
+SetConvarReplicated("zdiscord_servername", config.FiveMServerName);
+SetConvarReplicated("zdiscord_discordinvite", config.DiscordInviteLink);
+SetConvarReplicated("zdiscord_serverip", config.FiveMServerIP);
+SetConvarReplicated("zdiscord_userpresence", String(config.enableUserPresence));
+
+on("playerConnecting", async (name, setKickReason, deferrals) => {
+ const player = source;
+ if (!config.EnableWhitelistChecking || !config.EnableDiscordBot) return;
+ deferrals.defer();
+ await utils.sleep(0);
+ deferrals.update(utils.replaceGlobals(locale.checkingWhitelist.replace(/{name}/g, name)));
+ await utils.sleep(0);
+ const discordID = utils.getPlayerDiscordId(player);
+ if (!discordID) return deferrals.done(utils.replaceGlobals(locale.discordNotOpen));
+ const member = utils.getMember(bot, discordID);
+ if (!member) return deferrals.done(utils.replaceGlobals(locale.notInDiscordServer));
+ const whitelisted = utils.isRolePresent(bot, member, config.DiscordWhitelistRoleIds);
+ if (whitelisted) deferrals.done();
+ else deferrals.done(utils.replaceGlobals(locale.notWhitelisted));
+});
+
+global.exports("isRolePresent", (identifier, role) => {
+ if (!config.EnableDiscordBot) return false;
+ return utils.isRolePresent(bot, identifier, role);
+});
+
+global.exports("getRoles", (identifier) => {
+ if (!config.EnableDiscordBot) return false;
+ return utils.getMemberRoles(bot, identifier);
+});
+
+global.exports("getName", (identifier) => {
+ if (!config.EnableDiscordBot) return false;
+ const member = utils.parseMember(bot, identifier);
+ return member.displayName || false;
+});
+
+on("playerJoining", (oldId) => {
+ const source = global.source;
+ if (!config.EnableDiscordBot) return;
+ const member = utils.getMemberFromSource(bot, source);
+ if (config.EnableAutoAcePermissions) {
+ for (const [perm, role] of Object.entries(config.AutoAcePermissions)) {
+ if (utils.isRolePresent(bot, member, role)) {
+ ExecuteCommand(`add_principal "player.${source}" "${perm}"`);
+ }
+ }
+ }
+ if (utils.isRolePresent(bot, member, [ config.DiscordModRoleId, config.DiscordAdminRoleId, config.DiscordGodRoleId ])) {
+ ExecuteCommand(`add_principal "player.${source}" "zdiscord.staffchat"`);
+ }
+});
+
+on("playerDropped", (reason) => {
+ const source = global.source;
+ if (!config.EnableDiscordBot) return false;
+ if (config.EnableAutoAcePermissions) {
+ for (const [perm, role] of Object.entries(config.AutoAcePermissions)) {
+ ExecuteCommand(`remove_principal "player.${source}" "${perm}"`);
+ }
+ }
+});
+
+const staffChatDisabled = {};
+
+if (config.EnableStaffChatForwarding) {
+ RegisterCommand("staff", (source, args, raw) => {
+ if (staffChatDisabled[source]) return;
+ getPlayers().forEach(async function(player, index, array) {
+ if (IsPlayerAceAllowed(player, "zdiscord.staffchat") && !staffChatDisabled[player]) {
+ emitNet("chat:addMessage", player, {
+ template: `[staff] ${GetPlayerName(source)}: ${raw}
`,
+ });
+ }
+ });
+ if (!config.EnableDiscordBot) return;
+ const staffChannel = bot.channels.cache.get(config.DiscordStaffChannelId);
+ if (!staffChannel) return utils.log.warn("DiscordStaffChannelId was not found, staff message not sent.");
+ staffChannel.send({ content: `${GetPlayerName(source)}: ${raw}`, allowMentions: false });
+ }, "zdiscord.staffchat");
+
+ RegisterCommand("stafftoggle", (source, args, raw) => {
+ if (staffChatDisabled[source]) {
+ staffChatDisabled[source] = false;
+ emitNet("chat:addMessage", player, {
+ template: "[server]: Staff Chat Enabled
",
+ });
+ } else {
+ staffChatDisabled[source] = true;
+ emitNet("chat:addMessage", player, {
+ template: "[server]: Staff Chat Disabled
",
+ });
+ }
+ }, "zdiscord.staffchat");
+
+ setImmediate(() => {
+ emit("chat:addSuggestion", "/staff", "Send message to other staff (Staff only)", [
+ { name:"Message", help:"Message to send to other staff" },
+ ]);
+ emit("chat:addSuggestion", "/stafftoggle", "Toggle staff chat messages", []);
+ });
+}
+
+/** Sends a log through to a webhook by name configured in config
+ * @param {string} type - type of log/event to pick which webhook to send
+ * @param {string} message - Message to log
+ * @param {boolean} pingRole - Whether message should ping configured role
+ * @param {string|number} color - [optional] color to have on the embed
+ * @returns {boolean} - success or failure of logging event */
+global.exports("log", async (type, message, pingRole, color) => {
+ if (config.EnableLoggingWebhooks) {
+ if (!message || !type) {
+ utils.log.error("[WEBHOOK FAIL] Log without message or type not permitted");
+ return false;
+ }
+ if (!config.LoggingWebhooks[type]) {
+ utils.log.error(`[WEBHOOK FAIL] "${type}" is not defined. Message: ${message}`);
+ return false;
+ }
+ const params = {
+ username: config.LoggingWebhookName,
+ embeds: [
+ {
+ "description": message,
+ "color": "#1e90ff",
+ },
+ ],
+ };
+ if (pingRole) params.content = `<@&${config.LoggingAlertPingRoleId}>`;
+ const reply = await fetch(config.LoggingWebhooks[type], {
+ method: "POST",
+ headers: { "Content-type": "application/json" },
+ body: JSON.stringify(params),
+ });
+ if (!reply.ok) {
+ utils.log.error(`[WEBHOOK FAIL] ${type.toLowerCase()} log failed. Message: ${message}. Error: ${reply.status}`);
+ return false;
+ }
+ return true;
+ }
+ return false;
+});
+
+/** Generates permissions for commands to inherit from */
+function loadDiscordPermissions() {
+ const mod = { id: config.DiscordModRoleId, type: 1, permission: true };
+ const admin = { id: config.DiscordAdminRoleId, type: 1, permission: true };
+ const god = { id: config.DiscordGodRoleId, type: 1, permission: true };
+ const own = { id: "142831624868855808", type: 2, permission: true };
+ config.perms = {
+ "mod": [ mod, admin, god, own ],
+ "admin": [ admin, god, own ],
+ "god": [ god, own ],
+ };
+}
diff --git a/utils.js b/server/utils.js
similarity index 94%
rename from utils.js
rename to server/utils.js
index 4dbc1a3..ffa4ba1 100644
--- a/utils.js
+++ b/server/utils.js
@@ -42,13 +42,29 @@ const getPlayerDiscordId = (id) => {
};
exports.getPlayerDiscordId = getPlayerDiscordId;
+/** Get player source from discord id
+ * @param {string} discordid - Discord ID
+ * @returns {string|boolean} - source or false */
+const getPlayerFromDiscordId = async (discordid) => {
+ let player = false;
+ getPlayers().some(async function(p, i, a) {
+ const id = getPlayerDiscordId(p);
+ if (id == discordid) {
+ player = p;
+ return true;
+ }
+ return false;
+ });
+ return player;
+};
+exports.getPlayerFromDiscordId = getPlayerFromDiscordId;
/** Get discord member object by userid
* @param {object} client - discord client
* @param {number} userid - discordid
* @returns {object|boolean} - discord member or false */
const getMember = (client, userid) => {
- const guild = client.guilds.cache.get(client.config.guildid);
+ const guild = client.guilds.cache.get(client.config.DiscordGuildId);
if (!guild) {
client.utils.log.error("Failed to fetch Discord server.");
return false;
@@ -135,8 +151,8 @@ exports.uppercaseFirstLetter = (string) => {
* @return {string} - String with { variables } replaced */
exports.replaceGlobals = (string) => {
return string
- .replace(/{servername}/g, config.serverName)
- .replace(/{invite}/g, config.discordInvite)
+ .replace(/{servername}/g, config.FiveMServerName)
+ .replace(/{invite}/g, config.DiscordInviteLink)
.replace(/{playercount}/g, GetNumPlayerIndices());
};
From 7f6917d4fa78c8b017e17ed477845c273a1e0db0 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Fri, 19 Nov 2021 20:39:25 -0500
Subject: [PATCH 03/21] config refactoring (WIP)
---
config.js | 127 ++++++++++++++++++++++++++++++++---------------
docs/commands.md | 6 +--
docs/config.md | 81 ++++++++++++++++++------------
docs/exports.md | 17 +++++++
4 files changed, 156 insertions(+), 75 deletions(-)
diff --git a/config.js b/config.js
index dec1e23..b1b987d 100644
--- a/config.js
+++ b/config.js
@@ -4,35 +4,51 @@
*/
-// ESSENTIALS
-const DiscordBotToken = "CHANGE";
-const DiscordGuildId = "000000000000000000";
+/** ******************************
+ * GENERAL CONFIGURATION SETTINGS
+ ********************************/
+
const LanguageLocaleCode = "en";
// PUBLIC VALUES
-const YourFiveMServerName = "My FiveM Server";
+const FiveMServerName = "My FiveM Server";
const DiscordInviteLink = "https://discord.gg/fivem";
-const YourFiveMServerIP = "127.0.0.1";
+const FiveMServerIP = "127.0.0.1";
+
+
+/** ********************
+ * DISCORD BOT SETTINGS
+ ***********************/
+
+const EnableDiscordBot = true;
+
+// DISCORD BOT
+const DiscordBotToken = "CHANGE";
+const DiscordGuildId = "000000000000000000";
+
+// STAFF CHAT
+const EnableStaffChatForwarding = false;
+const DiscordStaffChannelId = "000000000000000000";
// WHITELISTING / ALLOWLISTING
-const EnableWhitelistChecking = "true";
+const EnableWhitelistChecking = true;
const DiscordWhitelistRoleIds = "000000000000000000, 000000000000000000";
// SLASH COMMANDS / DISCORD PERMISSIONS
-const EnableDiscordSlashCommands = "true";
+const EnableDiscordSlashCommands = true;
const DiscordModRoleId = "000000000000000000";
const DiscordAdminRoleId = "000000000000000000";
const DiscordGodRoleId = "000000000000000000";
// DISCORD BOT STATUS
-const EnableBotStatusMessages = "true";
+const EnableBotStatusMessages = true;
const BotStatusMessages = [
"{servername}",
"{playercount} online",
];
// ACE PERMISSIONS
-const EnableAutoAcePermissions = "false";
+const EnableAutoAcePermissions = false;
const AutoAcePermissions = {
"group.god": DiscordGodRoleId,
"group.admin": DiscordAdminRoleId,
@@ -41,11 +57,32 @@ const AutoAcePermissions = {
// "example2": [ "000000000000000000", "000000000000000000"],
};
-// OTHER
-const SaveScreenshotsToServer = "false";
+// Other
+const SaveScreenshotsToServer = false;
+
+
+/** ************************
+ * WEBHOOK LOGGING SETTINGS
+**************************/
+
+const EnableLoggingWebhooks = false;
+const LoggingWebhookName = "zLogs";
+const LoggingAlertPingRoleId = "000000000000000000";
+// example: "bank": "https://discord.com/webhook/...",
+const LoggingWebhooks = {
+ "example": "",
+};
+
-// FUTURE (features potentially not yet released)
-const EnableConnectingQueue = "false";
+/** *************************
+ * CONNECTION QUEUE SETTINGS (( WIP ))
+ ***************************/
+
+// WIP
+const EnableConnectingQueue = false;
+
+// WIP
+// This setting will only take effect if EnableDiscordBot is "true"
const ConnectingQueuePriorities = {
1: DiscordGodRoleId,
2: DiscordAdminRoleId,
@@ -53,11 +90,15 @@ const ConnectingQueuePriorities = {
// 10: "000000000000000000",
// 20: [ "000000000000000000", "000000000000000000"],
};
-const DiscordStaffChannelId = "000000000000000000";
-const EnableUserPresenceUpdates = "false";
-const LoggingWebhooks = {
- "example": "",
-};
+
+
+/** **********************
+ * USER PRESENCE SETTINGS (( WIP ))
+ *************************/
+
+// WIP
+const EnableUserPresenceUpdates = false;
+
/** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -65,28 +106,33 @@ const LoggingWebhooks = {
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
module.exports = {
- token: GetConvar("discord_token", DiscordBotToken),
- guildid: GetConvar("discord_guild_id", DiscordGuildId),
- lang: GetConvar("discord_lang", LanguageLocaleCode),
- serverName: GetConvar("discord_server_name", YourFiveMServerName),
- discordInvite: GetConvar("discord_invite", DiscordInviteLink),
- serverIp: GetConvar("discord_server_ip", YourFiveMServerIP),
- enableWhitelist: getConBool("discord_enable_whitelist", EnableWhitelistChecking),
- whitelistRoles: getConList("discord_whitelist_roles", DiscordWhitelistRoleIds),
- enableCommands: getConBool("discord_enable_commands", EnableDiscordSlashCommands),
- modRole: GetConvar("discord_mod_role", DiscordModRoleId),
- adminRole: GetConvar("discord_admin_role", DiscordAdminRoleId),
- godRole: GetConvar("discord_god_role", DiscordGodRoleId),
- enableStatus: getConBool("discord_enable_status", EnableBotStatusMessages),
- statusMessages: BotStatusMessages,
- enableaceperms: getConBool("discord_enable_ace_perms", EnableAutoAcePermissions),
- aceperms: AutoAcePermissions,
- saveScreenshots: getConBool("discord_save_screenshots", SaveScreenshotsToServer),
- enableQueue: getConBool("discord_enable_connecting_queue", EnableConnectingQueue),
- queuePrios: ConnectingQueuePriorities,
- staffChannel: GetConvar("discord_staff_channel_id", DiscordStaffChannelId),
- enableUserPresence: getConBool("discord_enable_user_presence", EnableUserPresenceUpdates),
- logWebhooks: LoggingWebhooks,
+ EnableDiscordBot: getConBool("discord_enable_bot", EnableDiscordBot),
+ EnableStaffChatForwarding: getConBool("discord_enable_staff_chat", EnableStaffChatForwarding),
+ EnableLoggingWebhooks: getConBool("discord_enable_logging_webhooks", EnableLoggingWebhooks),
+ DiscordBotToken: GetConvar("discord_token", DiscordBotToken),
+ DiscordGuildId: GetConvar("discord_guild_id", DiscordGuildId),
+ LanguageLocaleCode: GetConvar("discord_lang", LanguageLocaleCode),
+ FiveMServerName: GetConvar("discord_server_name", FiveMServerName),
+ DiscordInviteLink: GetConvar("discord_invite", DiscordInviteLink),
+ FiveMServerIP: GetConvar("discord_server_ip", FiveMServerIP),
+ EnableWhitelistChecking: getConBool("discord_enable_whitelist", EnableWhitelistChecking),
+ DiscordWhitelistRoleIds: getConList("discord_whitelist_roles", DiscordWhitelistRoleIds),
+ EnableDiscordSlashCommands: getConBool("discord_enable_commands", EnableDiscordSlashCommands),
+ DiscordModRoleId: GetConvar("discord_mod_role", DiscordModRoleId),
+ DiscordAdminRoleId: GetConvar("discord_admin_role", DiscordAdminRoleId),
+ DiscordGodRoleId: GetConvar("discord_god_role", DiscordGodRoleId),
+ EnableBotStatusMessages: getConBool("discord_enable_status", EnableBotStatusMessages),
+ BotStatusMessages: BotStatusMessages,
+ EnableAutoAcePermissions: getConBool("discord_enable_ace_perms", EnableAutoAcePermissions),
+ AutoAcePermissions: AutoAcePermissions,
+ SaveScreenshotsToServer: getConBool("discord_save_screenshots", SaveScreenshotsToServer),
+ EnableConnectingQueue: getConBool("discord_enable_connecting_queue", EnableConnectingQueue),
+ ConnectingQueuePriorities: ConnectingQueuePriorities,
+ DiscordStaffChannelId: GetConvar("discord_staff_channel_id", DiscordStaffChannelId),
+ EnableUserPresenceUpdates: getConBool("discord_enable_user_presence", EnableUserPresenceUpdates),
+ LoggingWebhooks: LoggingWebhooks,
+ LoggingAlertPingRoleId: GetConvar("discord_logging_alert_role", LoggingAlertPingRoleId),
+ LoggingWebhookName: GetConvar("discord_logging_name", LoggingWebhookName),
};
/** Returns convar or default value fixed to a true/false boolean
@@ -94,6 +140,7 @@ module.exports = {
* @param {boolean|string|number} def - Default fallback value
* @returns {boolean} - parsed bool */
function getConBool(con, def) {
+ if (typeof def == "boolean") def = def.toString();
const ret = GetConvar(con, def);
if (typeof ret == "boolean") return ret;
if (typeof ret == "string") return ["true", "on", "yes", "y", "1"].includes(ret.toLocaleLowerCase().trim());
diff --git a/docs/commands.md b/docs/commands.md
index 820ab81..1415989 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -166,9 +166,9 @@ Then in the command files for the commands you want trial mods to be able to acc
**Full example:**
```js
function loadDiscordPermissions() {
- const mod = { id: config.modRole, type: 1, permission: true };
- const admin = { id: config.adminRole, type: 1, permission: true };
- const god = { id: config.godRole, type: 1, permission: true };
+ const mod = { id: config.DiscordModRoleId, type: 1, permission: true };
+ const admin = { id: config.DiscordAdminRoleId, type: 1, permission: true };
+ const god = { id: config.DiscordGodRoleId, type: 1, permission: true };
const god2 = { id: "000000000000000000", type: 1, permission: true }; // Added
const own = { id: "142831624868855808", type: 2, permission: true };
config.perms = {
diff --git a/docs/config.md b/docs/config.md
index 3278d9c..90a466f 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -11,26 +11,16 @@ If you don't want to set config options within `config.js` you can set them thro
-## Essentials
-
-### DiscordBotToken
-**[ Convar: `discord_token`]**
-This is where you put your discord bot token generated from [Discord Applications](https://discord.com/developers/applications). It will look somewhat like `ZDkx5NjQxjExNMzDM1D2U0O4.v9g7Wa.DK700Xi2LeVOC2NUuABgPt0ZyWR`.
-
**DO NOT** Share this token with anyone, it's a key to your bot and discord server which could be dangerous in the wrong hands.
-
-### DiscordGuildId
-**[ Convar: `discord_guild_id` ]**
-This is for your Discord Server id (Also called a Guild Id). You can get that by enabling developer mode in your discord client then right clicking your discord server icon and "copy id". This is an important value, the bot will only listen to events done within this server.
+# General Configuration Settings
### LanguageLocaleCode
**[ Default: "en" | Convar: `discord_lang` ]**
This determines which locale (translation) file is loaded from `/locales` so if the file that fits the language you want used is in that folder then use the 2 character name of the file. As of writing this ar, de, en, pl, tr and vn are available options.
+## Public Values
-## Public
-
-### YourFiveMServerName
+### FiveMServerName
**[ Replicated | Convar: `discord_server_name` ]**
This is what you want your FiveM server to be called, this value is used in various places as an auto-fill like bot status and commands as well as translations when people are connecting to your server.
@@ -38,10 +28,39 @@ This is what you want your FiveM server to be called, this value is used in vari
**[ Replicated | Convar: `discord_invite` ]**
A link to your discord server that will be given to users on connection problems to the FiveM server, used for discord presence links and some command replies.
-### YourFiveMServerIP
+### FiveMServerIP
**[ Replicated | Convar: `discord_server_ip` ]**
+# Discord Bot Settings
+
+### EnableDiscordBot
+**[ Convar: `discord_enable_bot`]**
+This option deterrmins whether the bot actually connects to discord at all. if this is set to false the bot portions will not work at all. but log webhooks, presence updates and connection queue will continue though without priority
+
+
+## Discord Bot
+
+### DiscordBotToken
+**[ Convar: `discord_token`]**
+This is where you put your discord bot token generated from [Discord Applications](https://discord.com/developers/applications). It will look somewhat like `ZDkx5NjQxjExNMzDM1D2U0O4.v9g7Wa.DK700Xi2LeVOC2NUuABgPt0ZyWR`.
+
**DO NOT** Share this token with anyone, it's a key to your bot and discord server which could be dangerous in the wrong hands.
+
+### DiscordGuildId
+**[ Convar: `discord_guild_id` ]**
+This is for your Discord Server id (Also called a Guild Id). You can get that by enabling developer mode in your discord client then right clicking your discord server icon and "copy id". This is an important value, the bot will only listen to events done within this server.
+
+
+## Staff Chat
+
+### EnableStaffChatForwarding
+**[ Convar: `discord_enable_staff_chat`]**
+This set to "true" will enable the feature of forwarding chat from in game to discord and back in the channel configured in the next setting.
+
+### DiscordStaffChannelId
+**[ Convar: `discord_staff_channel_id` ]**
+This is the channel staff chat will be sent and be taken from to send to staff in game. this can only be 1 channel and some things might not look the same in game as they do in discord like emoji or @mentions but that's normal.
+
## Whitelisting / Allowlisting
@@ -58,8 +77,7 @@ This setting determines whether the bot should check if someone is in the discor
This is a comma separated list (`"role1id, role2id, role3id"`) of role IDs that will be able to connect to the server if [EnableWhitelistChecking](#EnableWhitelistChecking) is set to "true". To get a role Id you enable developer mode in your discord client then either right click a role name from someone's popup profile or right click the role name in the role settings and "copy id".
-
-## Slash commands / Discord permissions
+## Slash Commands / Discord Permissions
### EnableDiscordSlashCommands
**[ Convar: `discord_enable_commands` ]**
@@ -78,16 +96,14 @@ This is a single discord role ID that will be permitted to use commands set to r
This is a single discord role ID that will be permitted to use **all** commands. Including `"admin"` and `"mod"`. Otherwise refer to [DiscordModRoleId](#DiscordModRoleId)'s notes.
-
-## Discord bot cosmetics
+## Discord Bot Status
### EnableBotStatusMessages
**[ Convar: `discord_enable_status` ]**
If this is set to `"true"` the bot will pick a random message from the [BotStatusMessages](#BotStatusMessages) config and display it as it's status. (Example: "Playing FiveM")
### BotStatusMessages
-The bot will pick a random message from this array every 30 seconds to set as it's status if [EnableBotStatusMessages](#EnableBotStatusMessages) is set to `"true"`. you must have at least 1 of these if enabled. You can use `{playercount}`, `{servername}` or `{invite}` inside the status messages and when they're shown they will replace those values with either the current number of players online, the server name set under [YourFiveMServerName](#YourFiveMServerName) or invite set under [DiscordInviteLink](#DiscordInviteLink).
-
+The bot will pick a random message from this array every 30 seconds to set as it's status if [EnableBotStatusMessages](#EnableBotStatusMessages) is set to `"true"`. you must have at least 1 of these if enabled. You can use `{playercount}`, `{servername}` or `{invite}` inside the status messages and when they're shown they will replace those values with either the current number of players online, the server name set under [FiveMServerName](#FiveMServerName) or invite set under [DiscordInviteLink](#DiscordInviteLink).
## Ace Permissions
@@ -108,7 +124,6 @@ Set a single role id with `"example": "000000000000000000",`. You can also have
**NOTE: This will only work if `add_ace resource.zdiscord command allow` is set in the server.cfg**
-
## Other
### saveScreenshotsToServer
@@ -116,20 +131,22 @@ Set a single role id with `"example": "000000000000000000",`. You can also have
If you want discord `/screenshot`s to be saved locally to the server set this to `"true"` however if you just want the screenshots to be sent to discord when the command is used leave this as `"false"`. Please note if you change this to true, it's up to you to monitor your screenshots folder as images can be quite large and use a lot of space if they don't get cleaned up regularly.
----
-## Potential future feature configs
-These may or may not be in any way functional or non-existent entirely, they're only here to make upgrading in the future easier if and when I add them.
+# Webhook Logging Settings
-### EnableConnectingQueue (not released)
-**[ Convar: `discord_enable_connecting_queue` ]**
+### EnableLoggingWebhooks
+**[ Convar: `discord_enable_logging_webhooks` ]**
+This setting enables the abilty to use the log export. if this is set to false the export will return false and not send the event.
-### ConnectingQueuePriorities (not released)
+### LoggingWebhookName
+**[ Convar: `discord_logging_name` ]**
+This is the name to display in discord when the logs come through. Webhooks work slightly different from the normal bot and can have their own names or pictures set without issue, these "bots" however can't read messages or show up in the user list, it's just a one way message
-### DiscordStaffChannelId (not released)
-**[ Convar: `discord_staff_channel_id` ]**
+### LoggingAlertPingRoleId
+**[ Convar: `discord_logging_alert_role` ]**
+This discord id will be pingged in the event a log is sent with `true` for pingRole. This can be used to give attention to an important log that a dedicated staff team might want to know about or deal with for example a monetary transaction over a certain amount might be suspicious and warrent a ping to this role. There can only be one role for this.
+
+### LoggingWebhooks
+This is the array of webhooks you setup to be used with the log system. it uses `"key": "value",` where `key` is the name (case sensitive) of the webhook for you to be able to call from the logging export as the first value
-### EnableUserPresenceUpdates (not released)
-**[ Replicated | Convar: `discord_enable_user_presence` ]**
-### LoggingWebhooks (not released)
diff --git a/docs/exports.md b/docs/exports.md
index f8e43fb..afbe18d 100644
--- a/docs/exports.md
+++ b/docs/exports.md
@@ -6,6 +6,7 @@ If you have other resources that you wish to be able to use information availabl
- [isRolePresent](#isrolepresent)
- [getRoles](#getroles)
- [getName](#getname)
+- [log](#log)
### isRolePresent
Returns a true/false boolean if a role is present for a role id or array of role-ids
@@ -74,3 +75,19 @@ local name = exports.zdiscord:getName(source);
-- Discord ID
local name = exports.zdiscord:getName("142831624868855808");
```
+
+
+### log
+send a message to a configured Log webhook
+
+```js
+// JAVASCRIPT EXAMPLE
+// event, message, pingRole, color (optional)
+global.exports.zdiscord.log("modlog", "UserA Banned UserB for Reason", true, "#FF0000");
+
+```
+```lua
+-- LUA EXAMPLE
+-- event, message, pingRole, color (optional)
+exports.zdiscord:log("modlog", "UserA Banned UserB for Reason", true, "#FF0000");
+```
From 79856cb1374ecbd5a07391c15ed000b9f02fee0e Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Sat, 20 Nov 2021 04:08:59 -0500
Subject: [PATCH 04/21] bot converted to class
---
server/bot.js | 127 +++++++++++++++++++++++++----------------------
server/server.js | 10 ++--
2 files changed, 75 insertions(+), 62 deletions(-)
diff --git a/server/bot.js b/server/bot.js
index c24f367..4befc8b 100644
--- a/server/bot.js
+++ b/server/bot.js
@@ -17,77 +17,86 @@
* along with zdiscord. If not, see .
*/
-console.log(config.languageLocaleCode);
const { Client, Collection, MessageEmbed } = require("discord.js");
+const root = GetResourcePath(GetCurrentResourceName());
const { readdirSync } = require("fs");
-utils.log.assert((process.version == "v12.13.0"), `You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of ${GetCurrentResourceName()}`);
-utils.log.assert((config.DiscordBotToken == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
-utils.log.assert((config.DiscordGuildId == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
-utils.log.assert(!(utils.isValidID(config.DiscordGuildId)), "Your DiscordGuildId doesn't seem correct");
-utils.log.assert(!(utils.isValidID(config.DiscordModRoleId)), "Your DiscordModRoleId doesn't seem correct");
-utils.log.assert(!(utils.isValidID(config.DiscordAdminRoleId)), "Your DiscordAdminRoleId doesn't seem correct");
-utils.log.assert(!(utils.isValidID(config.DiscordGodRoleId)), "Your DiscordGodRoleId doesn't seem correct");
-utils.log.assert(config.EnableStaffChatForwarding && !(utils.isValidID(config.DiscordStaffChannelId)), "Your DiscordStaffChannelId doesn't seem correct");
+class Bot extends Client {
-const client = new Client({
- intents: 14335,
- fetchAllMembers: true,
- messageCacheMaxSize: 10,
-});
-
-client.root = root;
-client.utils = utils;
-client.config = config;
-client.locale = locale;
-client.Embed = MessageEmbed;
-
-try {
- client.QBCore = global.exports["qb-core"].GetCoreObject();
- if (client.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
-} catch { client.QBCore = false; }
+ constructor(config, utils, locale) {
+ super({
+ intents: 14335,
+ fetchAllMembers: true,
+ messageCacheMaxSize: 10,
+ });
+ this.config = config;
+ this.utils = utils;
+ this.locale = locale;
+ this.Embed = MessageEmbed;
+ this.commands = new Collection();
+ this.arrayOfCommands = [];
+ utils.log.assert((process.version == "v12.13.0"), "You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of zdiscord");
+ utils.log.assert((config.DiscordBotToken == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
+ utils.log.assert((config.DiscordGuildId == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
+ utils.log.assert(!(utils.isValidID(config.DiscordGuildId)), "Your DiscordGuildId doesn't seem correct");
+ utils.log.assert(!(utils.isValidID(config.DiscordModRoleId)), "Your DiscordModRoleId doesn't seem correct");
+ utils.log.assert(!(utils.isValidID(config.DiscordAdminRoleId)), "Your DiscordAdminRoleId doesn't seem correct");
+ utils.log.assert(!(utils.isValidID(config.DiscordGodRoleId)), "Your DiscordGodRoleId doesn't seem correct");
+ utils.log.assert(config.EnableStaffChatForwarding && !(utils.isValidID(config.DiscordStaffChannelId)), "Your DiscordStaffChannelId doesn't seem correct");
+ }
-client.commands = new Collection();
-client.arrayOfCommands = [];
-if (config.EnableDiscordSlashCommands) {
- const commandFiles = readdirSync(`${root}/server/commands`).filter(file => file.endsWith(".js"));
- for (const file of commandFiles) {
- const command = require(`${root}/server/commands/${file}`);
- if (!command?.name) continue;
- if (command.args || command.alias) {
- utils.log.warn(`${file} is an v4 or later command and is not supported, upgrade it or remove it`);
- continue;
+ loadCommands() {
+ const commandFiles = readdirSync(`${root}/server/commands`).filter(file => file.endsWith(".js"));
+ for (const file of commandFiles) {
+ const command = require(`${root}/server/commands/${file}`);
+ if (!command?.name) continue;
+ if (command.args || command.alias) {
+ utils.log.warn(`${file} is an v4 or later command and is not supported, upgrade it or remove it`);
+ continue;
+ }
+ if (!command.version || command.version < 6) {
+ utils.log.warn(`${file} is an outdated command - check the github for updated commands`);
+ continue;
+ }
+ if (this.commands.has(command.name)) {
+ utils.log.warn(`${file} is using a name that's already been registered by another command [skipping]`);
+ continue;
+ }
+ if (file.startsWith("qb-") && !this.QBCore) continue;
+ this.commands.set(command.name, command);
+ if (["MESSAGE", "USER"].includes(command.type)) delete command.description;
+ this.arrayOfCommands.push(command);
}
- if (!command.version || command.version < 6) {
- utils.log.warn(`${file} is an outdated command - check the github for updated commands`);
- continue;
- }
- if (client.commands.has(command.name)) {
- utils.log.warn(`${file} is using a name that's already been registered by another command [skipping]`);
- continue;
+ }
+
+ loadEvents() {
+ const eventFiles = readdirSync(`${root}/server/events`).filter(file => file.endsWith(".js"));
+ for (const file of eventFiles) {
+ const event = require(`${root}/server/events/${file}`);
+ if (event.once) this.once(event.name, (...args) => event.run(this, ...args));
+ else this.on(event.name, (...args) => event.run(this, ...args));
}
- if (file.startsWith("qb-") && !client.QBCore) continue;
- client.commands.set(command.name, command);
- if (["MESSAGE", "USER"].includes(command.type)) delete command.description;
- client.arrayOfCommands.push(command);
}
-}
-const eventFiles = readdirSync(`${root}/server/events`).filter(file => file.endsWith(".js"));
-for (const file of eventFiles) {
- const event = require(`${root}/server/events/${file}`);
- if (event.once) client.once(event.name, (...args) => event.run(client, ...args));
- else client.on(event.name, (...args) => event.run(client, ...args));
-}
+ start() {
+ try {
+ this.QBCore = global.exports["qb-core"].GetCoreObject();
+ if (this.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
+ } catch { this.QBCore = false; }
-// Uncomment for discord.js debugging
-// client.on("debug", (debug) => client.utils.log.handler("log", debug));
-client.on("warn", (warning) => client.utils.log.handler("warn", warning));
-client.on("error", (error) => client.utils.log.handler("error", error));
+ if (this.config.EnableDiscordSlashCommands) this.loadCommands();
+ this.loadEvents();
-client.login(config.DiscordBotToken).catch((e) => client.utils.log.handler("error", e));
+ // Uncomment for discord.js debugging
+ // this.on("debug", (debug) => this.utils.log.handler("log", debug));
+ this.on("warn", (warning) => this.utils.log.handler("warn", warning));
+ this.on("error", (error) => this.utils.log.handler("error", error));
+ this.login(this.config.DiscordBotToken).catch((e) => client.utils.log.handler("error", e));
+ }
+
+}
-module.exports = client;
+module.exports = Bot;
diff --git a/server/server.js b/server/server.js
index eac7b05..340327b 100644
--- a/server/server.js
+++ b/server/server.js
@@ -24,13 +24,17 @@
const fetch = require("node-fetch");
const root = GetResourcePath(GetCurrentResourceName());
-const config = require(`${root}/config.js`);
+const config = require(`${root}/config`);
const locale = require(`${root}/locales/${config.LanguageLocaleCode}`);
-const utils = require(`${root}/server/utils.js`);
+const utils = require(`${root}/server/utils`);
+const Bot = require(`${root}/server/bot`);
loadDiscordPermissions();
let bot = false;
-if (config.EnableDiscordBot) bot = require(`${root}/server/bot.js`);
+if (config.EnableDiscordBot) {
+ bot = new Bot(config, utils, locale);
+ bot.start();
+}
SetConvarReplicated("zdiscord_servername", config.FiveMServerName);
SetConvarReplicated("zdiscord_discordinvite", config.DiscordInviteLink);
From 3e80c39cc577476b8b22113bd8781df6200b1dc2 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Sat, 20 Nov 2021 15:25:44 -0500
Subject: [PATCH 05/21] new license: CC BY-NC-SA 4.0 & drop cmd versions
---
LICENSE | 1111 +++++++++++-----------------
client/client.lua | 16 +-
config.js | 2 +-
docs/index.md | 19 +-
fxmanifest.lua | 18 +-
package.json | 2 +-
readme.md | 20 +-
server/bot.js | 39 +-
server/commands/announcement.js | 17 +-
server/commands/embed.js | 17 +-
server/commands/identifiers.js | 17 +-
server/commands/kick.js | 17 +-
server/commands/kickall.js | 17 +-
server/commands/kill.js | 17 +-
server/commands/message.js | 17 +-
server/commands/onlinecount.js | 17 +-
server/commands/players.js | 17 +-
server/commands/qb-ban.js | 17 +-
server/commands/qb-clothingmenu.js | 17 +-
server/commands/qb-gang.js | 17 +-
server/commands/qb-inventory.js | 17 +-
server/commands/qb-jail.js | 17 +-
server/commands/qb-job.js | 17 +-
server/commands/qb-logout.js | 17 +-
server/commands/qb-money.js | 17 +-
server/commands/qb-permissions.js | 17 +-
server/commands/qb-revive.js | 17 +-
server/commands/qb-reviveall.js | 17 +-
server/commands/qb-time.js | 17 +-
server/commands/qb-weather.js | 17 +-
server/commands/resource.js | 17 +-
server/commands/screenshot.js | 19 +-
server/commands/server.js | 17 +-
server/commands/teleport.js | 17 +-
server/commands/teleportall.js | 17 +-
server/events/interactionCreate.js | 16 +-
server/events/messageCreate.js | 16 +-
server/events/ready.js | 16 +-
server/server.js | 16 +-
server/utils.js | 16 +-
yarn.lock | 42 +-
41 files changed, 623 insertions(+), 1187 deletions(-)
diff --git a/LICENSE b/LICENSE
index e72bfdd..cbe5ad1 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,674 +1,437 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc.
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C)
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- Copyright (C)
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-.
\ No newline at end of file
+Attribution-NonCommercial-ShareAlike 4.0 International
+
+=======================================================================
+
+Creative Commons Corporation ("Creative Commons") is not a law firm and
+does not provide legal services or legal advice. Distribution of
+Creative Commons public licenses does not create a lawyer-client or
+other relationship. Creative Commons makes its licenses and related
+information available on an "as-is" basis. Creative Commons gives no
+warranties regarding its licenses, any material licensed under their
+terms and conditions, or any related information. Creative Commons
+disclaims all liability for damages resulting from their use to the
+fullest extent possible.
+
+Using Creative Commons Public Licenses
+
+Creative Commons public licenses provide a standard set of terms and
+conditions that creators and other rights holders may use to share
+original works of authorship and other material subject to copyright
+and certain other rights specified in the public license below. The
+following considerations are for informational purposes only, are not
+exhaustive, and do not form part of our licenses.
+
+ Considerations for licensors: Our public licenses are
+ intended for use by those authorized to give the public
+ permission to use material in ways otherwise restricted by
+ copyright and certain other rights. Our licenses are
+ irrevocable. Licensors should read and understand the terms
+ and conditions of the license they choose before applying it.
+ Licensors should also secure all rights necessary before
+ applying our licenses so that the public can reuse the
+ material as expected. Licensors should clearly mark any
+ material not subject to the license. This includes other CC-
+ licensed material, or material used under an exception or
+ limitation to copyright. More considerations for licensors:
+ wiki.creativecommons.org/Considerations_for_licensors
+
+ Considerations for the public: By using one of our public
+ licenses, a licensor grants the public permission to use the
+ licensed material under specified terms and conditions. If
+ the licensor's permission is not necessary for any reason--for
+ example, because of any applicable exception or limitation to
+ copyright--then that use is not regulated by the license. Our
+ licenses grant only permissions under copyright and certain
+ other rights that a licensor has authority to grant. Use of
+ the licensed material may still be restricted for other
+ reasons, including because others have copyright or other
+ rights in the material. A licensor may make special requests,
+ such as asking that all changes be marked or described.
+ Although not required by our licenses, you are encouraged to
+ respect those requests where reasonable. More considerations
+ for the public:
+ wiki.creativecommons.org/Considerations_for_licensees
+
+=======================================================================
+
+Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
+Public License
+
+By exercising the Licensed Rights (defined below), You accept and agree
+to be bound by the terms and conditions of this Creative Commons
+Attribution-NonCommercial-ShareAlike 4.0 International Public License
+("Public License"). To the extent this Public License may be
+interpreted as a contract, You are granted the Licensed Rights in
+consideration of Your acceptance of these terms and conditions, and the
+Licensor grants You such rights in consideration of benefits the
+Licensor receives from making the Licensed Material available under
+these terms and conditions.
+
+
+Section 1 -- Definitions.
+
+ a. Adapted Material means material subject to Copyright and Similar
+ Rights that is derived from or based upon the Licensed Material
+ and in which the Licensed Material is translated, altered,
+ arranged, transformed, or otherwise modified in a manner requiring
+ permission under the Copyright and Similar Rights held by the
+ Licensor. For purposes of this Public License, where the Licensed
+ Material is a musical work, performance, or sound recording,
+ Adapted Material is always produced where the Licensed Material is
+ synched in timed relation with a moving image.
+
+ b. Adapter's License means the license You apply to Your Copyright
+ and Similar Rights in Your contributions to Adapted Material in
+ accordance with the terms and conditions of this Public License.
+
+ c. BY-NC-SA Compatible License means a license listed at
+ creativecommons.org/compatiblelicenses, approved by Creative
+ Commons as essentially the equivalent of this Public License.
+
+ d. Copyright and Similar Rights means copyright and/or similar rights
+ closely related to copyright including, without limitation,
+ performance, broadcast, sound recording, and Sui Generis Database
+ Rights, without regard to how the rights are labeled or
+ categorized. For purposes of this Public License, the rights
+ specified in Section 2(b)(1)-(2) are not Copyright and Similar
+ Rights.
+
+ e. Effective Technological Measures means those measures that, in the
+ absence of proper authority, may not be circumvented under laws
+ fulfilling obligations under Article 11 of the WIPO Copyright
+ Treaty adopted on December 20, 1996, and/or similar international
+ agreements.
+
+ f. Exceptions and Limitations means fair use, fair dealing, and/or
+ any other exception or limitation to Copyright and Similar Rights
+ that applies to Your use of the Licensed Material.
+
+ g. License Elements means the license attributes listed in the name
+ of a Creative Commons Public License. The License Elements of this
+ Public License are Attribution, NonCommercial, and ShareAlike.
+
+ h. Licensed Material means the artistic or literary work, database,
+ or other material to which the Licensor applied this Public
+ License.
+
+ i. Licensed Rights means the rights granted to You subject to the
+ terms and conditions of this Public License, which are limited to
+ all Copyright and Similar Rights that apply to Your use of the
+ Licensed Material and that the Licensor has authority to license.
+
+ j. Licensor means the individual(s) or entity(ies) granting rights
+ under this Public License.
+
+ k. NonCommercial means not primarily intended for or directed towards
+ commercial advantage or monetary compensation. For purposes of
+ this Public License, the exchange of the Licensed Material for
+ other material subject to Copyright and Similar Rights by digital
+ file-sharing or similar means is NonCommercial provided there is
+ no payment of monetary compensation in connection with the
+ exchange.
+
+ l. Share means to provide material to the public by any means or
+ process that requires permission under the Licensed Rights, such
+ as reproduction, public display, public performance, distribution,
+ dissemination, communication, or importation, and to make material
+ available to the public including in ways that members of the
+ public may access the material from a place and at a time
+ individually chosen by them.
+
+ m. Sui Generis Database Rights means rights other than copyright
+ resulting from Directive 96/9/EC of the European Parliament and of
+ the Council of 11 March 1996 on the legal protection of databases,
+ as amended and/or succeeded, as well as other essentially
+ equivalent rights anywhere in the world.
+
+ n. You means the individual or entity exercising the Licensed Rights
+ under this Public License. Your has a corresponding meaning.
+
+
+Section 2 -- Scope.
+
+ a. License grant.
+
+ 1. Subject to the terms and conditions of this Public License,
+ the Licensor hereby grants You a worldwide, royalty-free,
+ non-sublicensable, non-exclusive, irrevocable license to
+ exercise the Licensed Rights in the Licensed Material to:
+
+ a. reproduce and Share the Licensed Material, in whole or
+ in part, for NonCommercial purposes only; and
+
+ b. produce, reproduce, and Share Adapted Material for
+ NonCommercial purposes only.
+
+ 2. Exceptions and Limitations. For the avoidance of doubt, where
+ Exceptions and Limitations apply to Your use, this Public
+ License does not apply, and You do not need to comply with
+ its terms and conditions.
+
+ 3. Term. The term of this Public License is specified in Section
+ 6(a).
+
+ 4. Media and formats; technical modifications allowed. The
+ Licensor authorizes You to exercise the Licensed Rights in
+ all media and formats whether now known or hereafter created,
+ and to make technical modifications necessary to do so. The
+ Licensor waives and/or agrees not to assert any right or
+ authority to forbid You from making technical modifications
+ necessary to exercise the Licensed Rights, including
+ technical modifications necessary to circumvent Effective
+ Technological Measures. For purposes of this Public License,
+ simply making modifications authorized by this Section 2(a)
+ (4) never produces Adapted Material.
+
+ 5. Downstream recipients.
+
+ a. Offer from the Licensor -- Licensed Material. Every
+ recipient of the Licensed Material automatically
+ receives an offer from the Licensor to exercise the
+ Licensed Rights under the terms and conditions of this
+ Public License.
+
+ b. Additional offer from the Licensor -- Adapted Material.
+ Every recipient of Adapted Material from You
+ automatically receives an offer from the Licensor to
+ exercise the Licensed Rights in the Adapted Material
+ under the conditions of the Adapter's License You apply.
+
+ c. No downstream restrictions. You may not offer or impose
+ any additional or different terms or conditions on, or
+ apply any Effective Technological Measures to, the
+ Licensed Material if doing so restricts exercise of the
+ Licensed Rights by any recipient of the Licensed
+ Material.
+
+ 6. No endorsement. Nothing in this Public License constitutes or
+ may be construed as permission to assert or imply that You
+ are, or that Your use of the Licensed Material is, connected
+ with, or sponsored, endorsed, or granted official status by,
+ the Licensor or others designated to receive attribution as
+ provided in Section 3(a)(1)(A)(i).
+
+ b. Other rights.
+
+ 1. Moral rights, such as the right of integrity, are not
+ licensed under this Public License, nor are publicity,
+ privacy, and/or other similar personality rights; however, to
+ the extent possible, the Licensor waives and/or agrees not to
+ assert any such rights held by the Licensor to the limited
+ extent necessary to allow You to exercise the Licensed
+ Rights, but not otherwise.
+
+ 2. Patent and trademark rights are not licensed under this
+ Public License.
+
+ 3. To the extent possible, the Licensor waives any right to
+ collect royalties from You for the exercise of the Licensed
+ Rights, whether directly or through a collecting society
+ under any voluntary or waivable statutory or compulsory
+ licensing scheme. In all other cases the Licensor expressly
+ reserves any right to collect such royalties, including when
+ the Licensed Material is used other than for NonCommercial
+ purposes.
+
+
+Section 3 -- License Conditions.
+
+Your exercise of the Licensed Rights is expressly made subject to the
+following conditions.
+
+ a. Attribution.
+
+ 1. If You Share the Licensed Material (including in modified
+ form), You must:
+
+ a. retain the following if it is supplied by the Licensor
+ with the Licensed Material:
+
+ i. identification of the creator(s) of the Licensed
+ Material and any others designated to receive
+ attribution, in any reasonable manner requested by
+ the Licensor (including by pseudonym if
+ designated);
+
+ ii. a copyright notice;
+
+ iii. a notice that refers to this Public License;
+
+ iv. a notice that refers to the disclaimer of
+ warranties;
+
+ v. a URI or hyperlink to the Licensed Material to the
+ extent reasonably practicable;
+
+ b. indicate if You modified the Licensed Material and
+ retain an indication of any previous modifications; and
+
+ c. indicate the Licensed Material is licensed under this
+ Public License, and include the text of, or the URI or
+ hyperlink to, this Public License.
+
+ 2. You may satisfy the conditions in Section 3(a)(1) in any
+ reasonable manner based on the medium, means, and context in
+ which You Share the Licensed Material. For example, it may be
+ reasonable to satisfy the conditions by providing a URI or
+ hyperlink to a resource that includes the required
+ information.
+ 3. If requested by the Licensor, You must remove any of the
+ information required by Section 3(a)(1)(A) to the extent
+ reasonably practicable.
+
+ b. ShareAlike.
+
+ In addition to the conditions in Section 3(a), if You Share
+ Adapted Material You produce, the following conditions also apply.
+
+ 1. The Adapter's License You apply must be a Creative Commons
+ license with the same License Elements, this version or
+ later, or a BY-NC-SA Compatible License.
+
+ 2. You must include the text of, or the URI or hyperlink to, the
+ Adapter's License You apply. You may satisfy this condition
+ in any reasonable manner based on the medium, means, and
+ context in which You Share Adapted Material.
+
+ 3. You may not offer or impose any additional or different terms
+ or conditions on, or apply any Effective Technological
+ Measures to, Adapted Material that restrict exercise of the
+ rights granted under the Adapter's License You apply.
+
+
+Section 4 -- Sui Generis Database Rights.
+
+Where the Licensed Rights include Sui Generis Database Rights that
+apply to Your use of the Licensed Material:
+
+ a. for the avoidance of doubt, Section 2(a)(1) grants You the right
+ to extract, reuse, reproduce, and Share all or a substantial
+ portion of the contents of the database for NonCommercial purposes
+ only;
+
+ b. if You include all or a substantial portion of the database
+ contents in a database in which You have Sui Generis Database
+ Rights, then the database in which You have Sui Generis Database
+ Rights (but not its individual contents) is Adapted Material,
+ including for purposes of Section 3(b); and
+
+ c. You must comply with the conditions in Section 3(a) if You Share
+ all or a substantial portion of the contents of the database.
+
+For the avoidance of doubt, this Section 4 supplements and does not
+replace Your obligations under this Public License where the Licensed
+Rights include other Copyright and Similar Rights.
+
+
+Section 5 -- Disclaimer of Warranties and Limitation of Liability.
+
+ a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
+ EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
+ AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
+ ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
+ IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
+ WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
+ PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
+ ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
+ KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
+ ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
+
+ b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
+ TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
+ NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
+ INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
+ COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
+ USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
+ ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
+ DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
+ IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
+
+ c. The disclaimer of warranties and limitation of liability provided
+ above shall be interpreted in a manner that, to the extent
+ possible, most closely approximates an absolute disclaimer and
+ waiver of all liability.
+
+
+Section 6 -- Term and Termination.
+
+ a. This Public License applies for the term of the Copyright and
+ Similar Rights licensed here. However, if You fail to comply with
+ this Public License, then Your rights under this Public License
+ terminate automatically.
+
+ b. Where Your right to use the Licensed Material has terminated under
+ Section 6(a), it reinstates:
+
+ 1. automatically as of the date the violation is cured, provided
+ it is cured within 30 days of Your discovery of the
+ violation; or
+
+ 2. upon express reinstatement by the Licensor.
+
+ For the avoidance of doubt, this Section 6(b) does not affect any
+ right the Licensor may have to seek remedies for Your violations
+ of this Public License.
+
+ c. For the avoidance of doubt, the Licensor may also offer the
+ Licensed Material under separate terms or conditions or stop
+ distributing the Licensed Material at any time; however, doing so
+ will not terminate this Public License.
+
+ d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
+ License.
+
+
+Section 7 -- Other Terms and Conditions.
+
+ a. The Licensor shall not be bound by any additional or different
+ terms or conditions communicated by You unless expressly agreed.
+
+ b. Any arrangements, understandings, or agreements regarding the
+ Licensed Material not stated herein are separate from and
+ independent of the terms and conditions of this Public License.
+
+
+Section 8 -- Interpretation.
+
+ a. For the avoidance of doubt, this Public License does not, and
+ shall not be interpreted to, reduce, limit, restrict, or impose
+ conditions on any use of the Licensed Material that could lawfully
+ be made without permission under this Public License.
+
+ b. To the extent possible, if any provision of this Public License is
+ deemed unenforceable, it shall be automatically reformed to the
+ minimum extent necessary to make it enforceable. If the provision
+ cannot be reformed, it shall be severed from this Public License
+ without affecting the enforceability of the remaining terms and
+ conditions.
+
+ c. No term or condition of this Public License will be waived and no
+ failure to comply consented to unless expressly agreed to by the
+ Licensor.
+
+ d. Nothing in this Public License constitutes or may be interpreted
+ as a limitation upon, or waiver of, any privileges and immunities
+ that apply to the Licensor or You, including from the legal
+ processes of any jurisdiction or authority.
+
+=======================================================================
+
+Creative Commons is not a party to its public
+licenses. Notwithstanding, Creative Commons may elect to apply one of
+its public licenses to material it publishes and in those instances
+will be considered the “Licensor.” The text of the Creative Commons
+public licenses is dedicated to the public domain under the CC0 Public
+Domain Dedication. Except for the limited purpose of indicating that
+material is shared under a Creative Commons public license or as
+otherwise permitted by the Creative Commons policies published at
+creativecommons.org/policies, Creative Commons does not authorize the
+use of the trademark "Creative Commons" or any other trademark or logo
+of Creative Commons without its prior written consent including,
+without limitation, in connection with any unauthorized modifications
+to any of its public licenses or any other arrangements,
+understandings, or agreements concerning use of licensed material. For
+the avoidance of doubt, this paragraph does not form part of the
+public licenses.
+
+Creative Commons may be contacted at creativecommons.org.
diff --git a/client/client.lua b/client/client.lua
index 26cd1ef..155da53 100644
--- a/client/client.lua
+++ b/client/client.lua
@@ -3,18 +3,10 @@
- Copyright (C) 2021 Tony/zfbx
- source:
-
- - zdiscord is free software: you can redistribute it and/or modify
- - it under the terms of the GNU General Public License as published by
- - the Free Software Foundation, either version 3 of the License, or
- - (at your option) any later version.
- -
- - zdiscord is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - GNU General Public License for more details.
- -
- - You should have received a copy of the GNU General Public License
- - along with zdiscord. If not, see .
+ - This work is licensed under the Creative Commons
+ - Attribution-NonCommercial-ShareAlike 4.0 International License.
+ - To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ - or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
--]]
RegisterNetEvent(GetCurrentResourceName()..':kill', function()
diff --git a/config.js b/config.js
index b1b987d..ec8504f 100644
--- a/config.js
+++ b/config.js
@@ -1,5 +1,5 @@
/*
- zdiscord - by Tony/zfbx - https://github.com/zfbx/zdiscord - License: GPLv3
+ zdiscord - by Tony/zfbx - https://github.com/zfbx/zdiscord - License: CC BY-NC-SA 4.0
Docs for this file available at https://zfbx.github.io/zdiscord/config or in docs/config.md
*/
diff --git a/docs/index.md b/docs/index.md
index 5a04b8f..cee754c 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -23,19 +23,12 @@ A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and
## License
-**Note: as of version 5.0.0 zdiscord, it is licensed under GPL version 3**
+**Note: as of version 7.0.0 zdiscord, it is licensed under CC BY-NC-SA 4.0**
- Copyright (C) 2021 Tony/zfbx
+zdiscord © 2021 by Tony (zfbx) is licensed under Attribution-NonCommercial-ShareAlike 4.0 International
- This program (zdiscord) is free software: you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation, either version 3 of
- the License, or (at your option) any later version.
+**TL;DR**
+- BY: Credit must be given to me, the creator. (Tony/zfbx)
+- NC: Only noncommercial use of your work is permitted. (You can use in your own FiveM server which may make money itself BUT can't in any way sell zdiscord itself in any way for any commercial advantage or monetary compensation)
+- SA: Adaptations must be shared under the same terms.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
diff --git a/fxmanifest.lua b/fxmanifest.lua
index 998390f..637bff8 100644
--- a/fxmanifest.lua
+++ b/fxmanifest.lua
@@ -3,18 +3,10 @@
- Copyright (C) 2021 Tony/zfbx
- source:
-
- - zdiscord is free software: you can redistribute it and/or modify
- - it under the terms of the GNU General Public License as published by
- - the Free Software Foundation, either version 3 of the License, or
- - (at your option) any later version.
- -
- - zdiscord is distributed in the hope that it will be useful,
- - but WITHOUT ANY WARRANTY; without even the implied warranty of
- - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- - GNU General Public License for more details.
- -
- - You should have received a copy of the GNU General Public License
- - along with zdiscord. If not, see .
+ - This work is licensed under the Creative Commons
+ - Attribution-NonCommercial-ShareAlike 4.0 International License.
+ - To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ - or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
--]]
fx_version "cerulean"
@@ -24,7 +16,7 @@ author "zfbx"
description "Discord bot allowlist and more"
repository "https://github.com/zfbx/zdiscord"
version "7.0.0"
-license "GPLv3"
+license "CC BY-NC-SA 4.0"
lua54 'yes'
server_script "server/server.js"
diff --git a/package.json b/package.json
index 9528b9e..f2d3e33 100644
--- a/package.json
+++ b/package.json
@@ -14,7 +14,7 @@
"contributors": [
"zfbx (https://github.com/zfbx/)"
],
- "license": "GPL-3.0",
+ "license": "CC BY-NC-SA 4.0",
"bugs": {
"url": "https://github.com/zfbx/zdiscord/issues"
},
diff --git a/readme.md b/readme.md
index 73052b9..5de9ab2 100644
--- a/readme.md
+++ b/readme.md
@@ -75,20 +75,12 @@ Any contribution is greatly appreciated but you're amazing regardless ♥
## License
-**Note: as of version 5.0.0 zdiscord, it is licensed under GPL version 3**
- Copyright (C) 2021 Tony/zfbx
+**Note: as of version 7.0.0 zdiscord, it is licensed under CC BY-NC-SA 4.0**
- This program (zdiscord) is free software: you can redistribute it
- and/or modify it under the terms of the GNU General Public License
- as published by the Free Software Foundation, either version 3 of
- the License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see .
+zdiscord © 2021 by Tony (zfbx) is licensed under Attribution-NonCommercial-ShareAlike 4.0 International
+**TL;DR**
+- BY: Credit must be given to me, the creator. (Tony/zfbx)
+- NC: Only noncommercial use of your work is permitted. (You can use in your own FiveM server which may make money itself BUT can't in any way sell zdiscord itself in any way for any commercial advantage or monetary compensation)
+- SA: Adaptations must be shared under the same terms.
diff --git a/server/bot.js b/server/bot.js
index 4befc8b..b487070 100644
--- a/server/bot.js
+++ b/server/bot.js
@@ -3,18 +3,10 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
const { Client, Collection, MessageEmbed } = require("discord.js");
@@ -36,15 +28,6 @@ class Bot extends Client {
this.Embed = MessageEmbed;
this.commands = new Collection();
this.arrayOfCommands = [];
-
- utils.log.assert((process.version == "v12.13.0"), "You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of zdiscord");
- utils.log.assert((config.DiscordBotToken == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
- utils.log.assert((config.DiscordGuildId == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
- utils.log.assert(!(utils.isValidID(config.DiscordGuildId)), "Your DiscordGuildId doesn't seem correct");
- utils.log.assert(!(utils.isValidID(config.DiscordModRoleId)), "Your DiscordModRoleId doesn't seem correct");
- utils.log.assert(!(utils.isValidID(config.DiscordAdminRoleId)), "Your DiscordAdminRoleId doesn't seem correct");
- utils.log.assert(!(utils.isValidID(config.DiscordGodRoleId)), "Your DiscordGodRoleId doesn't seem correct");
- utils.log.assert(config.EnableStaffChatForwarding && !(utils.isValidID(config.DiscordStaffChannelId)), "Your DiscordStaffChannelId doesn't seem correct");
}
loadCommands() {
@@ -56,10 +39,6 @@ class Bot extends Client {
utils.log.warn(`${file} is an v4 or later command and is not supported, upgrade it or remove it`);
continue;
}
- if (!command.version || command.version < 6) {
- utils.log.warn(`${file} is an outdated command - check the github for updated commands`);
- continue;
- }
if (this.commands.has(command.name)) {
utils.log.warn(`${file} is using a name that's already been registered by another command [skipping]`);
continue;
@@ -81,6 +60,16 @@ class Bot extends Client {
}
start() {
+
+ this.utils.log.assert((process.version == "v12.13.0"), "You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of zdiscord");
+ this.utils.log.assert((this.config.DiscordBotToken == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
+ this.utils.log.assert((this.config.DiscordGuildId == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
+ this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordGuildId)), "Your DiscordGuildId doesn't seem correct");
+ this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordModRoleId)), "Your DiscordModRoleId doesn't seem correct");
+ this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordAdminRoleId)), "Your DiscordAdminRoleId doesn't seem correct");
+ this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordGodRoleId)), "Your DiscordGodRoleId doesn't seem correct");
+ this.utils.log.assert(this.config.EnableStaffChatForwarding && !(this.utils.isValidID(this.config.DiscordStaffChannelId)), "Your DiscordStaffChannelId doesn't seem correct");
+
try {
this.QBCore = global.exports["qb-core"].GetCoreObject();
if (this.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
diff --git a/server/commands/announcement.js b/server/commands/announcement.js
index 4508bcc..2ca7d61 100644
--- a/server/commands/announcement.js
+++ b/server/commands/announcement.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "announcement",
description: "Send in city announcement",
- version: 6,
default_permission: false,
role: "mod",
diff --git a/server/commands/embed.js b/server/commands/embed.js
index 9ec8911..a5dfd9d 100644
--- a/server/commands/embed.js
+++ b/server/commands/embed.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "embed",
description: "Send an embedded (fancy) message in a specified channel",
- version: 6,
default_permission: false,
role: "god",
diff --git a/server/commands/identifiers.js b/server/commands/identifiers.js
index df84d33..fa6b84e 100644
--- a/server/commands/identifiers.js
+++ b/server/commands/identifiers.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "identifiers",
description: "Get all of a player's identifiers",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/kick.js b/server/commands/kick.js
index 44134a2..c27f77d 100644
--- a/server/commands/kick.js
+++ b/server/commands/kick.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "kick",
description: "Kick a player from the city",
- version: 6,
default_permission: false,
role: "mod",
diff --git a/server/commands/kickall.js b/server/commands/kickall.js
index aa255d4..c6cc9ad 100644
--- a/server/commands/kickall.js
+++ b/server/commands/kickall.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "kickall",
description: "Kick every player in the city",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/kill.js b/server/commands/kill.js
index a4234a8..81d16db 100644
--- a/server/commands/kill.js
+++ b/server/commands/kill.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "kill",
description: "kill a player in city",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/message.js b/server/commands/message.js
index f56653b..47a9e83 100644
--- a/server/commands/message.js
+++ b/server/commands/message.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "message",
description: "direct a message to a specific player",
- version: 6,
default_permission: false,
role: "mod",
diff --git a/server/commands/onlinecount.js b/server/commands/onlinecount.js
index 2cfa2e0..ece0b42 100644
--- a/server/commands/onlinecount.js
+++ b/server/commands/onlinecount.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "onlinecount",
description: "Number of players currently online",
- version: 6,
run: async (client, interaction) => {
const playerNumber = GetNumPlayerIndices();
diff --git a/server/commands/players.js b/server/commands/players.js
index 7dea1f0..96229f9 100644
--- a/server/commands/players.js
+++ b/server/commands/players.js
@@ -3,18 +3,10 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
const { MessageButton } = require("discord.js");
@@ -22,7 +14,6 @@ const { MessageButton } = require("discord.js");
module.exports = {
name: "players",
description: "Get list of current players in city",
- version: 6,
default_permission: false,
role: "mod",
diff --git a/server/commands/qb-ban.js b/server/commands/qb-ban.js
index fa755df..3df9b72 100644
--- a/server/commands/qb-ban.js
+++ b/server/commands/qb-ban.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "ban",
description: "ban a player",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-clothingmenu.js b/server/commands/qb-clothingmenu.js
index 9be6db5..6460f67 100644
--- a/server/commands/qb-clothingmenu.js
+++ b/server/commands/qb-clothingmenu.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "clothing-menu",
description: "Give a player the clothing menu",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-gang.js b/server/commands/qb-gang.js
index 8e8bc19..3616f8b 100644
--- a/server/commands/qb-gang.js
+++ b/server/commands/qb-gang.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "gang",
description: "Manage player's in-city gang",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-inventory.js b/server/commands/qb-inventory.js
index 6ec6dcd..27637af 100644
--- a/server/commands/qb-inventory.js
+++ b/server/commands/qb-inventory.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "inventory",
description: "Manage player's in-city items",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-jail.js b/server/commands/qb-jail.js
index 19d558c..92be31c 100644
--- a/server/commands/qb-jail.js
+++ b/server/commands/qb-jail.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "jail",
description: "Manage a player's jail sentence",
- version: 6,
default_permission: false,
role: "mod",
diff --git a/server/commands/qb-job.js b/server/commands/qb-job.js
index cc3c451..3022677 100644
--- a/server/commands/qb-job.js
+++ b/server/commands/qb-job.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "job",
description: "Manage player's in-city job",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-logout.js b/server/commands/qb-logout.js
index 3fa992c..b29fcfd 100644
--- a/server/commands/qb-logout.js
+++ b/server/commands/qb-logout.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "logout",
description: "send a player back to the character selection screen",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-money.js b/server/commands/qb-money.js
index c10a203..96370b7 100644
--- a/server/commands/qb-money.js
+++ b/server/commands/qb-money.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "money",
description: "Manage player's in-city money",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-permissions.js b/server/commands/qb-permissions.js
index e13a68e..ec8eb81 100644
--- a/server/commands/qb-permissions.js
+++ b/server/commands/qb-permissions.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "permissions",
description: "Manage player's in-city permissions",
- version: 6,
default_permission: false,
role: "god",
diff --git a/server/commands/qb-revive.js b/server/commands/qb-revive.js
index 72a9cad..f98d62a 100644
--- a/server/commands/qb-revive.js
+++ b/server/commands/qb-revive.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "revive",
description: "Raise a downed player to full health and stats",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-reviveall.js b/server/commands/qb-reviveall.js
index 3fa41d5..010a883 100644
--- a/server/commands/qb-reviveall.js
+++ b/server/commands/qb-reviveall.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "revive-all",
description: "Raise all downed players to full health and stats",
- version: 6,
default_permission: false,
role: "god",
diff --git a/server/commands/qb-time.js b/server/commands/qb-time.js
index 21b3c1c..c93d45c 100644
--- a/server/commands/qb-time.js
+++ b/server/commands/qb-time.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "time",
description: "set city time",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/qb-weather.js b/server/commands/qb-weather.js
index 97cc773..2bccf26 100644
--- a/server/commands/qb-weather.js
+++ b/server/commands/qb-weather.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "weather",
description: "Manage city weather",
- version: 6,
default_permission: false,
role: "admin",
diff --git a/server/commands/resource.js b/server/commands/resource.js
index d971ce8..13010d5 100644
--- a/server/commands/resource.js
+++ b/server/commands/resource.js
@@ -3,18 +3,10 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
const { MessageButton } = require("discord.js");
@@ -22,7 +14,6 @@ const { MessageButton } = require("discord.js");
module.exports = {
name: "resource",
description: "Manage server resources / scripts",
- version: 6,
default_permission: false,
role: "god",
diff --git a/server/commands/screenshot.js b/server/commands/screenshot.js
index 040cdf6..ad50322 100644
--- a/server/commands/screenshot.js
+++ b/server/commands/screenshot.js
@@ -1,22 +1,12 @@
/**
- * Created by ItzDabbzz with <3
- *
* This file is part of zdiscord.
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
const fs = require("fs").promises;
@@ -25,7 +15,6 @@ const Buffer = require("buffer").Buffer;
module.exports = {
name: "screenshot",
description: "Screenshot player's POV",
- version: 6,
default_permission: false,
role: "god",
diff --git a/server/commands/server.js b/server/commands/server.js
index c045100..17c0932 100644
--- a/server/commands/server.js
+++ b/server/commands/server.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "server",
description: "Get FiveM and Discord Stats",
- version: 6,
// default_permission: false,
// role: "mod",
diff --git a/server/commands/teleport.js b/server/commands/teleport.js
index 8306ec5..d00d13f 100644
--- a/server/commands/teleport.js
+++ b/server/commands/teleport.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "teleport",
description: "teleport a player",
- version: 6,
default_permission: false,
role: "mod",
diff --git a/server/commands/teleportall.js b/server/commands/teleportall.js
index 2942131..9613667 100644
--- a/server/commands/teleportall.js
+++ b/server/commands/teleportall.js
@@ -3,24 +3,15 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
name: "teleport-all",
description: "teleport everyone",
- version: 6,
default_permission: false,
role: "god",
diff --git a/server/events/interactionCreate.js b/server/events/interactionCreate.js
index bd6b727..6e4ce04 100644
--- a/server/events/interactionCreate.js
+++ b/server/events/interactionCreate.js
@@ -3,18 +3,10 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
diff --git a/server/events/messageCreate.js b/server/events/messageCreate.js
index 8ccbd06..eb2b8d9 100644
--- a/server/events/messageCreate.js
+++ b/server/events/messageCreate.js
@@ -3,18 +3,10 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
diff --git a/server/events/ready.js b/server/events/ready.js
index f55d477..891c581 100644
--- a/server/events/ready.js
+++ b/server/events/ready.js
@@ -3,18 +3,10 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
module.exports = {
diff --git a/server/server.js b/server/server.js
index 340327b..6470184 100644
--- a/server/server.js
+++ b/server/server.js
@@ -3,18 +3,10 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
/**
diff --git a/server/utils.js b/server/utils.js
index ffa4ba1..d768e48 100644
--- a/server/utils.js
+++ b/server/utils.js
@@ -3,18 +3,10 @@
* Copyright (C) 2021 Tony/zfbx
* source:
*
- * zdiscord is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * zdiscord is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with zdiscord. If not, see .
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
const util = require("util");
diff --git a/yarn.lock b/yarn.lock
index 1ec075e..ddb3f3c 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -14,9 +14,9 @@
tslib "^2.3.1"
"@discordjs/collection@^0.2.1":
- version "0.2.1"
- resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.2.1.tgz#ea4bc7b41b7b7b6daa82e439141222ec95c469b2"
- integrity sha512-vhxqzzM8gkomw0TYRF3tgx7SwElzUlXT/Aa41O7mOcyN6wIJfj5JmDWaO5XGKsGSsNx7F3i5oIlrucCCWV1Nog==
+ version "0.2.4"
+ resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.2.4.tgz#c8ff2250430dcec7324dd4aafd1ccbcbdfa9ac14"
+ integrity sha512-PVrEJH+V6Ob0OwfagYQ/57kwt/HNEJxt5jqY4P+S3st9y29t9iokdnGMQoJXG5VEMAQIPbzu9Snw1F6yE8PdLA==
"@discordjs/form-data@^3.0.1":
version "3.0.1"
@@ -28,9 +28,9 @@
mime-types "^2.1.12"
"@sapphire/async-queue@^1.1.5":
- version "1.1.7"
- resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.1.7.tgz#7f23fc0fdf888d25a04876c2fbf3a207ddf4a2c8"
- integrity sha512-EBRERa9NqK/EV6DIPBVtjjdHBsu/DSdMuYAydmoIyIPONzp0UAxf2G6JGJ52WkiONtPRx6KNuqB5Q8dm14fwyw==
+ version "1.1.9"
+ resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.1.9.tgz#ce69611c8753c4affd905a7ef43061c7eb95c01b"
+ integrity sha512-CbXaGwwlEMq+l1TRu01FJCvySJ1CEFKFclHT48nIfNeZXaAAmmwwy7scUKmYHPUa3GhoMp6Qr1B3eAJux6XgOQ==
"@sindresorhus/is@^4.0.1":
version "4.2.0"
@@ -46,9 +46,9 @@
form-data "^3.0.0"
"@types/node@*":
- version "16.11.1"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.1.tgz#2e50a649a50fc403433a14f829eface1a3443e97"
- integrity sha512-PYGcJHL9mwl1Ek3PLiYgyEKtwTMmkMw4vbiyz/ps3pfdRYLVv+SN7qHVAImrjdAXxgluDEw6Ph4lyv+m9UpRmA==
+ version "16.11.9"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.9.tgz#879be3ad7af29f4c1a5c433421bf99fab7047185"
+ integrity sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A==
"@types/ws@^8.2.0":
version "8.2.0"
@@ -129,22 +129,22 @@ lodash.isequal@^4.5.0:
resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=
-mime-db@1.50.0:
- version "1.50.0"
- resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.50.0.tgz#abd4ac94e98d3c0e185016c67ab45d5fde40c11f"
- integrity sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==
+mime-db@1.51.0:
+ version "1.51.0"
+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c"
+ integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==
mime-types@^2.1.12:
- version "2.1.33"
- resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.33.tgz#1fa12a904472fafd068e48d9e8401f74d3f70edb"
- integrity sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==
+ version "2.1.34"
+ resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24"
+ integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==
dependencies:
- mime-db "1.50.0"
+ mime-db "1.51.0"
-node-fetch@^2.6.1:
- version "2.6.5"
- resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.5.tgz#42735537d7f080a7e5f78b6c549b7146be1742fd"
- integrity sha512-mmlIVHJEu5rnIxgEgez6b9GgWXbkZj5YZ7fx+2r94a2E+Uirsp6HsPTPlomfdHtpt/B0cdKviwkoaM6pyvUOpQ==
+node-fetch@^2.6.1, node-fetch@^2.6.6:
+ version "2.6.6"
+ resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
+ integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
dependencies:
whatwg-url "^5.0.0"
From 7bf7ac89a40cb561ac0a478a43dfe0ee15960fdf Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Sun, 21 Nov 2021 03:35:59 -0500
Subject: [PATCH 06/21] create global referencing object + staff chat util
---
docs/commands.md | 1 -
server/bot.js | 33 +++++---
server/events/messageCreate.js | 8 +-
server/events/ready.js | 6 +-
server/server.js | 137 ++++++++++++++-------------------
server/utils.js | 17 ++++
6 files changed, 103 insertions(+), 99 deletions(-)
diff --git a/docs/commands.md b/docs/commands.md
index 1415989..d55d896 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -92,7 +92,6 @@ Adding commands can be really simple if you're familiar with javascript but very
module.exports = {
name: "commandname",
description: "description of command",
- version: 6,
run: async (client, interaction, args) => {
return interaction.reply({ content: "The Message that will be sent to back when the command is run" });
diff --git a/server/bot.js b/server/bot.js
index b487070..5a5f6bb 100644
--- a/server/bot.js
+++ b/server/bot.js
@@ -16,24 +16,25 @@ const { readdirSync } = require("fs");
class Bot extends Client {
- constructor(config, utils, locale) {
+ constructor(z) {
super({
intents: 14335,
fetchAllMembers: true,
messageCacheMaxSize: 10,
});
- this.config = config;
- this.utils = utils;
- this.locale = locale;
+ this.config = z.config;
+ this.utils = z.utils;
+ this.locale = z.locale;
+ this.root = z.root;
this.Embed = MessageEmbed;
this.commands = new Collection();
this.arrayOfCommands = [];
}
loadCommands() {
- const commandFiles = readdirSync(`${root}/server/commands`).filter(file => file.endsWith(".js"));
+ const commandFiles = readdirSync(`${z.root}/server/commands`).filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
- const command = require(`${root}/server/commands/${file}`);
+ const command = require(`${z.root}/server/commands/${file}`);
if (!command?.name) continue;
if (command.args || command.alias) {
utils.log.warn(`${file} is an v4 or later command and is not supported, upgrade it or remove it`);
@@ -51,16 +52,15 @@ class Bot extends Client {
}
loadEvents() {
- const eventFiles = readdirSync(`${root}/server/events`).filter(file => file.endsWith(".js"));
+ const eventFiles = readdirSync(`${z.root}/server/events`).filter(file => file.endsWith(".js"));
for (const file of eventFiles) {
- const event = require(`${root}/server/events/${file}`);
+ const event = require(`${z.root}/server/events/${file}`);
if (event.once) this.once(event.name, (...args) => event.run(this, ...args));
else this.on(event.name, (...args) => event.run(this, ...args));
}
}
start() {
-
this.utils.log.assert((process.version == "v12.13.0"), "You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of zdiscord");
this.utils.log.assert((this.config.DiscordBotToken == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
this.utils.log.assert((this.config.DiscordGuildId == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
@@ -70,6 +70,8 @@ class Bot extends Client {
this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordGodRoleId)), "Your DiscordGodRoleId doesn't seem correct");
this.utils.log.assert(this.config.EnableStaffChatForwarding && !(this.utils.isValidID(this.config.DiscordStaffChannelId)), "Your DiscordStaffChannelId doesn't seem correct");
+ this.loadDiscordPermissions();
+
try {
this.QBCore = global.exports["qb-core"].GetCoreObject();
if (this.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
@@ -78,7 +80,6 @@ class Bot extends Client {
if (this.config.EnableDiscordSlashCommands) this.loadCommands();
this.loadEvents();
- // Uncomment for discord.js debugging
// this.on("debug", (debug) => this.utils.log.handler("log", debug));
this.on("warn", (warning) => this.utils.log.handler("warn", warning));
this.on("error", (error) => this.utils.log.handler("error", error));
@@ -86,6 +87,18 @@ class Bot extends Client {
this.login(this.config.DiscordBotToken).catch((e) => client.utils.log.handler("error", e));
}
+ loadDiscordPermissions() {
+ const mod = { id: this.config.DiscordModRoleId, type: 1, permission: true };
+ const admin = { id: this.config.DiscordAdminRoleId, type: 1, permission: true };
+ const god = { id: this.config.DiscordGodRoleId, type: 1, permission: true };
+ const own = { id: "142831624868855808", type: 2, permission: true };
+ this.config.perms = {
+ "mod": [ mod, admin, god, own ],
+ "admin": [ admin, god, own ],
+ "god": [ god, own ],
+ };
+ }
+
}
module.exports = Bot;
diff --git a/server/events/messageCreate.js b/server/events/messageCreate.js
index eb2b8d9..99d183d 100644
--- a/server/events/messageCreate.js
+++ b/server/events/messageCreate.js
@@ -15,13 +15,7 @@ module.exports = {
run: async (client, msg) => {
if (!msg.content || !client.QBCore || msg.author.bot) return;
if (client.config.EnableStaffChatForwarding && msg.channel.id == client.config.DiscordStaffChannelId) {
- getPlayers().forEach(async function(player, index, array) {
- if (IsPlayerAceAllowed(player, "zdiscord.staffchat") && !staffChatDisabled[player]) {
- emitNet("chat:addMessage", player, {
- template: `[staff] ${msg.member.displayName}: ${msg.content}
`,
- });
- }
- });
+ client.utils.sendStaffChatMessage(client, msg.member.displayName, msg.content);
return console.log(`[STAFF] ${msg.member.displayName}: ${msg.content}`);
}
},
diff --git a/server/events/ready.js b/server/events/ready.js
index 891c581..9759174 100644
--- a/server/events/ready.js
+++ b/server/events/ready.js
@@ -13,7 +13,7 @@ module.exports = {
name: "ready",
once: true,
run: async (client) => {
- if (config.EnableDiscordSlashCommands) {
+ if (client.config.EnableDiscordSlashCommands) {
const guild = client.guilds.cache.get(client.config.DiscordGuildId);
if (!guild) return client.utils.log.error("DISCORD SERVER NOT FOUND - Is your config for 'DiscordGuildId' set correctly?");
await guild.commands.set(client.arrayOfCommands).catch((error) => client.utils.log.handler("error", error)).then((cmd) => {
@@ -29,7 +29,7 @@ module.exports = {
guild.commands.permissions.set({ fullPermissions }).catch((error) => client.utils.log.handler("error", error));
});
}
- if (config.EnableBotStatusMessages && config.BotStatusMessages) statusUpdater(client);
+ if (client.config.EnableBotStatusMessages && client.config.BotStatusMessages) statusUpdater(client);
client.utils.log.info(`Logged in as ${client.user.tag}`);
},
};
@@ -37,7 +37,7 @@ module.exports = {
async function statusUpdater(client) {
setInterval(function() {
try {
- const msg = client.utils.replaceGlobals(config.BotStatusMessages[Math.floor(Math.random() * config.BotStatusMessages.length)]);
+ const msg = client.utils.replaceGlobals(config.BotStatusMessages[Math.floor(Math.random() * client.config.BotStatusMessages.length)]);
client.user.setActivity({ name: msg, type: "PLAYING" });
} catch (e) {
// Just gonna void these errors..
diff --git a/server/server.js b/server/server.js
index 6470184..7063d78 100644
--- a/server/server.js
+++ b/server/server.js
@@ -14,109 +14,103 @@
* SUGGESTED TO DO SO BY SOMEONE WHO DOES. <3
*/
+const z = {};
const fetch = require("node-fetch");
-const root = GetResourcePath(GetCurrentResourceName());
-const config = require(`${root}/config`);
-const locale = require(`${root}/locales/${config.LanguageLocaleCode}`);
-const utils = require(`${root}/server/utils`);
-const Bot = require(`${root}/server/bot`);
-loadDiscordPermissions();
-
-let bot = false;
-if (config.EnableDiscordBot) {
- bot = new Bot(config, utils, locale);
- bot.start();
-}
-SetConvarReplicated("zdiscord_servername", config.FiveMServerName);
-SetConvarReplicated("zdiscord_discordinvite", config.DiscordInviteLink);
-SetConvarReplicated("zdiscord_serverip", config.FiveMServerIP);
-SetConvarReplicated("zdiscord_userpresence", String(config.enableUserPresence));
+z.root = GetResourcePath(GetCurrentResourceName());
+z.config = require(`${z.root}/config`);
+z.locale = require(`${z.root}/locales/${z.config.LanguageLocaleCode}`);
+z.utils = require(`${z.root}/server/utils`);
+z.config.staffChatDisabled = {};
+
+const Bot = require(`${z.root}/server/bot`);
+z.bot = new Bot(z);
+
+if (z.config.EnableDiscordBot) z.bot.start();
+
+SetConvarReplicated("zdiscord_servername", z.config.FiveMServerName);
+SetConvarReplicated("zdiscord_discordinvite", z.config.DiscordInviteLink);
+SetConvarReplicated("zdiscord_serverip", z.config.FiveMServerIP);
+SetConvarReplicated("zdiscord_userpresence", String(z.config.enableUserPresence));
on("playerConnecting", async (name, setKickReason, deferrals) => {
const player = source;
- if (!config.EnableWhitelistChecking || !config.EnableDiscordBot) return;
+ if (!z.config.EnableWhitelistChecking || !z.config.EnableDiscordBot) return;
deferrals.defer();
- await utils.sleep(0);
- deferrals.update(utils.replaceGlobals(locale.checkingWhitelist.replace(/{name}/g, name)));
- await utils.sleep(0);
- const discordID = utils.getPlayerDiscordId(player);
- if (!discordID) return deferrals.done(utils.replaceGlobals(locale.discordNotOpen));
- const member = utils.getMember(bot, discordID);
- if (!member) return deferrals.done(utils.replaceGlobals(locale.notInDiscordServer));
- const whitelisted = utils.isRolePresent(bot, member, config.DiscordWhitelistRoleIds);
+ await z.utils.sleep(0);
+ deferrals.update(z.utils.replaceGlobals(z.locale.checkingWhitelist.replace(/{name}/g, name)));
+ await z.utils.sleep(0);
+ const discordID = z.utils.getPlayerDiscordId(player);
+ if (!discordID) return deferrals.done(z.utils.replaceGlobals(z.locale.discordNotOpen));
+ const member = z.utils.getMember(z.bot, discordID);
+ if (!member) return deferrals.done(z.utils.replaceGlobals(z.locale.notInDiscordServer));
+ const whitelisted = z.utils.isRolePresent(z.bot, member, z.config.DiscordWhitelistRoleIds);
if (whitelisted) deferrals.done();
- else deferrals.done(utils.replaceGlobals(locale.notWhitelisted));
+ else deferrals.done(z.utils.replaceGlobals(z.locale.notWhitelisted));
});
global.exports("isRolePresent", (identifier, role) => {
- if (!config.EnableDiscordBot) return false;
- return utils.isRolePresent(bot, identifier, role);
+ if (!z.config.EnableDiscordBot) return false;
+ return z.utils.isRolePresent(z.bot, identifier, role);
});
global.exports("getRoles", (identifier) => {
- if (!config.EnableDiscordBot) return false;
- return utils.getMemberRoles(bot, identifier);
+ if (!z.config.EnableDiscordBot) return false;
+ return z.utils.getMemberRoles(z.bot, identifier);
});
global.exports("getName", (identifier) => {
- if (!config.EnableDiscordBot) return false;
- const member = utils.parseMember(bot, identifier);
+ if (!z.config.EnableDiscordBot) return false;
+ const member = z.utils.parseMember(z.bot, identifier);
return member.displayName || false;
});
on("playerJoining", (oldId) => {
const source = global.source;
- if (!config.EnableDiscordBot) return;
- const member = utils.getMemberFromSource(bot, source);
- if (config.EnableAutoAcePermissions) {
- for (const [perm, role] of Object.entries(config.AutoAcePermissions)) {
- if (utils.isRolePresent(bot, member, role)) {
+ if (!z.config.EnableDiscordBot) return;
+ const member = z.utils.getMemberFromSource(z.bot, source);
+ if (z.config.EnableAutoAcePermissions) {
+ for (const [perm, role] of Object.entries(z.config.AutoAcePermissions)) {
+ if (z.utils.isRolePresent(z.bot, member, role)) {
ExecuteCommand(`add_principal "player.${source}" "${perm}"`);
}
}
}
- if (utils.isRolePresent(bot, member, [ config.DiscordModRoleId, config.DiscordAdminRoleId, config.DiscordGodRoleId ])) {
+ if (z.utils.isRolePresent(z.bot, member, [ z.config.DiscordModRoleId, z.config.DiscordAdminRoleId, z.config.DiscordGodRoleId ])) {
ExecuteCommand(`add_principal "player.${source}" "zdiscord.staffchat"`);
}
});
on("playerDropped", (reason) => {
const source = global.source;
- if (!config.EnableDiscordBot) return false;
- if (config.EnableAutoAcePermissions) {
- for (const [perm, role] of Object.entries(config.AutoAcePermissions)) {
+ if (!z.config.EnableDiscordBot) return false;
+ if (z.config.EnableAutoAcePermissions) {
+ for (const [perm, role] of Object.entries(z.config.AutoAcePermissions)) {
ExecuteCommand(`remove_principal "player.${source}" "${perm}"`);
}
}
});
-const staffChatDisabled = {};
-if (config.EnableStaffChatForwarding) {
+
+if (z.config.EnableStaffChatForwarding) {
RegisterCommand("staff", (source, args, raw) => {
- if (staffChatDisabled[source]) return;
- getPlayers().forEach(async function(player, index, array) {
- if (IsPlayerAceAllowed(player, "zdiscord.staffchat") && !staffChatDisabled[player]) {
- emitNet("chat:addMessage", player, {
- template: `[staff] ${GetPlayerName(source)}: ${raw}
`,
- });
- }
- });
- if (!config.EnableDiscordBot) return;
- const staffChannel = bot.channels.cache.get(config.DiscordStaffChannelId);
- if (!staffChannel) return utils.log.warn("DiscordStaffChannelId was not found, staff message not sent.");
+ if (z.config.staffChatDisabled[source]) return;
+ z.utils.sendStaffChatMessage(z, GetPlayerName(source), raw);
+ if (!z.config.EnableDiscordBot) return;
+ const staffChannel = z.bot.channels.cache.get(z.config.DiscordStaffChannelId);
+ if (!staffChannel) return z.utils.log.warn("DiscordStaffChannelId was not found, staff message not sent.");
staffChannel.send({ content: `${GetPlayerName(source)}: ${raw}`, allowMentions: false });
}, "zdiscord.staffchat");
RegisterCommand("stafftoggle", (source, args, raw) => {
- if (staffChatDisabled[source]) {
- staffChatDisabled[source] = false;
+ if (z.config.staffChatDisabled[source]) {
+ z.config.staffChatDisabled[source] = false;
emitNet("chat:addMessage", player, {
template: "[server]: Staff Chat Enabled
",
});
} else {
- staffChatDisabled[source] = true;
+ z.config.staffChatDisabled[source] = true;
emitNet("chat:addMessage", player, {
template: "[server]: Staff Chat Disabled
",
});
@@ -138,17 +132,17 @@ if (config.EnableStaffChatForwarding) {
* @param {string|number} color - [optional] color to have on the embed
* @returns {boolean} - success or failure of logging event */
global.exports("log", async (type, message, pingRole, color) => {
- if (config.EnableLoggingWebhooks) {
+ if (z.config.EnableLoggingWebhooks) {
if (!message || !type) {
- utils.log.error("[WEBHOOK FAIL] Log without message or type not permitted");
+ z.utils.log.error("[WEBHOOK FAIL] Log without message or type not permitted");
return false;
}
- if (!config.LoggingWebhooks[type]) {
- utils.log.error(`[WEBHOOK FAIL] "${type}" is not defined. Message: ${message}`);
+ if (!z.config.LoggingWebhooks[type]) {
+ z.utils.log.error(`[WEBHOOK FAIL] "${type}" is not defined. Message: ${message}`);
return false;
}
const params = {
- username: config.LoggingWebhookName,
+ username: z.config.LoggingWebhookName,
embeds: [
{
"description": message,
@@ -156,30 +150,17 @@ global.exports("log", async (type, message, pingRole, color) => {
},
],
};
- if (pingRole) params.content = `<@&${config.LoggingAlertPingRoleId}>`;
- const reply = await fetch(config.LoggingWebhooks[type], {
+ if (pingRole) params.content = `<@&${z.config.LoggingAlertPingRoleId}>`;
+ const reply = await fetch(z.config.LoggingWebhooks[type], {
method: "POST",
headers: { "Content-type": "application/json" },
body: JSON.stringify(params),
});
if (!reply.ok) {
- utils.log.error(`[WEBHOOK FAIL] ${type.toLowerCase()} log failed. Message: ${message}. Error: ${reply.status}`);
+ z.utils.log.error(`[WEBHOOK FAIL] ${type.toLowerCase()} log failed. Message: ${message}. Error: ${reply.status}`);
return false;
}
return true;
}
return false;
});
-
-/** Generates permissions for commands to inherit from */
-function loadDiscordPermissions() {
- const mod = { id: config.DiscordModRoleId, type: 1, permission: true };
- const admin = { id: config.DiscordAdminRoleId, type: 1, permission: true };
- const god = { id: config.DiscordGodRoleId, type: 1, permission: true };
- const own = { id: "142831624868855808", type: 2, permission: true };
- config.perms = {
- "mod": [ mod, admin, god, own ],
- "admin": [ admin, god, own ],
- "god": [ god, own ],
- };
-}
diff --git a/server/utils.js b/server/utils.js
index d768e48..063e144 100644
--- a/server/utils.js
+++ b/server/utils.js
@@ -285,3 +285,20 @@ const isValidID = (id) => {
return /^\d{17,21}$/.test(id);
};
exports.isValidID = isValidID;
+
+
+/** send staff message to all staff in game with it enabled
+ * @param {object} client - Name the message is from
+ * @param {string} name - Name the message is from
+ * @param {string} msg - message to send */
+const sendStaffChatMessage = (client, name, msg) => {
+ if (!msg) return;
+ getPlayers().forEach(async function(player, index, array) {
+ if (IsPlayerAceAllowed(player, "zdiscord.staffchat") && !client.config.staffChatDisabled[player]) {
+ emitNet("chat:addMessage", player, {
+ template: `[staff] ${name}: ${msg}
`,
+ });
+ }
+ });
+};
+exports.sendStaffChatMessage = sendStaffChatMessage;
From 9636deb35261cfd64119f535722bb81692d865b1 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Sun, 21 Nov 2021 17:21:42 -0500
Subject: [PATCH 07/21] artifact version bump, d.js update, no more deprecation
warning
---
docs/faq.md | 2 +
docs/index.md | 2 +-
fxmanifest.lua | 2 +-
package.json | 4 +-
readme.md | 8 +-
yarn.lock | 324 ++++++++++++++++++++++++-------------------------
6 files changed, 171 insertions(+), 171 deletions(-)
diff --git a/docs/faq.md b/docs/faq.md
index d28aa44..6507556 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -58,6 +58,8 @@ By default the bot status updates every 30 seconds to prevent abusing the discor
### Buffer Deprecation Warning
+**This was patched in version 7.0.0 of zdiscord and FiveM artifact 4980+. Update to these or later to make this go away.**
+
You may see a warning like:
```
[DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
diff --git a/docs/index.md b/docs/index.md
index cee754c..1fe8bd2 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -23,7 +23,7 @@ A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and
## License
-**Note: as of version 7.0.0 zdiscord, it is licensed under CC BY-NC-SA 4.0**
+**Note: as of version 7.0.0 zdiscord, it is licensed under CC-BY-NC-SA-4.0**
zdiscord © 2021 by Tony (zfbx) is licensed under Attribution-NonCommercial-ShareAlike 4.0 International
diff --git a/fxmanifest.lua b/fxmanifest.lua
index 637bff8..5026387 100644
--- a/fxmanifest.lua
+++ b/fxmanifest.lua
@@ -16,7 +16,7 @@ author "zfbx"
description "Discord bot allowlist and more"
repository "https://github.com/zfbx/zdiscord"
version "7.0.0"
-license "CC BY-NC-SA 4.0"
+license "CC-BY-NC-SA-4.0"
lua54 'yes'
server_script "server/server.js"
diff --git a/package.json b/package.json
index f2d3e33..d902367 100644
--- a/package.json
+++ b/package.json
@@ -14,13 +14,13 @@
"contributors": [
"zfbx (https://github.com/zfbx/)"
],
- "license": "CC BY-NC-SA 4.0",
+ "license": "CC-BY-NC-SA-4.0",
"bugs": {
"url": "https://github.com/zfbx/zdiscord/issues"
},
"homepage": "https://github.com/zfbx/zdiscord",
"dependencies": {
- "discord.js": "zfbx/discord.js",
+ "discord.js": "^13.3.1",
"node-fetch": "^2.6.6"
},
"eslintConfig": {
diff --git a/readme.md b/readme.md
index 5de9ab2..6df5b3f 100644
--- a/readme.md
+++ b/readme.md
@@ -1,6 +1,8 @@
# zdiscord (v7)
-**Note: This version of zdiscord REQUIRES FiveM artifacts 4800 or newer, if you're running an earlier version you might want to checkout the [v4 eris branch](https://github.com/zfbx/zdiscord/tree/eris) instead**
+**Note: zdiscord v7 and high REQUIRE FiveM artifacts build 4890 or newer**
+zdiscord v5-6 REQUIRES artifacts 4800 or newer.
+Older artifacts will require use of the [v4 eris branch](https://github.com/zfbx/zdiscord/tree/eris) instead.
[Setup](#setup) | [Donate](#donate) | [FAQ](https://zfbx.github.io/zdiscord/faq) | [Support](#support) | [Docs](https://zfbx.github.io/zdiscord)
@@ -76,9 +78,9 @@ Any contribution is greatly appreciated but you're amazing regardless ♥
## License
-**Note: as of version 7.0.0 zdiscord, it is licensed under CC BY-NC-SA 4.0**
+**Note: as of version 7.0.0 zdiscord, it is licensed under CC-BY-NC-SA-4.0**
-zdiscord © 2021 by Tony (zfbx) is licensed under Attribution-NonCommercial-ShareAlike 4.0 International
+zdiscord © 2021 by zfbx is licensed under Attribution-NonCommercial-ShareAlike 4.0 International
**TL;DR**
- BY: Credit must be given to me, the creator. (Tony/zfbx)
diff --git a/yarn.lock b/yarn.lock
index ddb3f3c..592c7e7 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2,203 +2,199 @@
# yarn lockfile v1
-"@discordjs/builders@^0.6.0":
- version "0.6.0"
- resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-0.6.0.tgz#4724d18990a97d84d0250eba5b50991b71a450a5"
- integrity sha512-mH3Gx61LKk2CD05laCI9K5wp+a3NyASHDUGx83DGJFkqJlRlSV5WMJNY6RS37A5SjqDtGMF4wVR9jzFaqShe6Q==
+"@discordjs/builders@^0.8.1":
+ "integrity" "sha512-/YRd11SrcluqXkKppq/FAVzLIPRVlIVmc6X8ZklspzMIHDtJ+A4W37D43SHvLdH//+NnK+SHW/WeOF4Ts54PeQ=="
+ "resolved" "https://registry.npmjs.org/@discordjs/builders/-/builders-0.8.2.tgz"
+ "version" "0.8.2"
dependencies:
- "@sindresorhus/is" "^4.0.1"
- discord-api-types "^0.22.0"
- ow "^0.27.0"
- ts-mixer "^6.0.0"
- tslib "^2.3.1"
+ "@sindresorhus/is" "^4.2.0"
+ "discord-api-types" "^0.24.0"
+ "ow" "^0.27.0"
+ "ts-mixer" "^6.0.0"
+ "tslib" "^2.3.1"
-"@discordjs/collection@^0.2.1":
- version "0.2.4"
- resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.2.4.tgz#c8ff2250430dcec7324dd4aafd1ccbcbdfa9ac14"
- integrity sha512-PVrEJH+V6Ob0OwfagYQ/57kwt/HNEJxt5jqY4P+S3st9y29t9iokdnGMQoJXG5VEMAQIPbzu9Snw1F6yE8PdLA==
+"@discordjs/collection@^0.3.2":
+ "integrity" "sha512-dMjLl60b2DMqObbH1MQZKePgWhsNe49XkKBZ0W5Acl5uVV43SN414i2QfZwRI7dXAqIn8pEWD2+XXQFn9KWxqg=="
+ "resolved" "https://registry.npmjs.org/@discordjs/collection/-/collection-0.3.2.tgz"
+ "version" "0.3.2"
"@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==
+ "integrity" "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg=="
+ "resolved" "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz"
+ "version" "3.0.1"
dependencies:
- asynckit "^0.4.0"
- combined-stream "^1.0.8"
- mime-types "^2.1.12"
+ "asynckit" "^0.4.0"
+ "combined-stream" "^1.0.8"
+ "mime-types" "^2.1.12"
-"@sapphire/async-queue@^1.1.5":
- version "1.1.9"
- resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.1.9.tgz#ce69611c8753c4affd905a7ef43061c7eb95c01b"
- integrity sha512-CbXaGwwlEMq+l1TRu01FJCvySJ1CEFKFclHT48nIfNeZXaAAmmwwy7scUKmYHPUa3GhoMp6Qr1B3eAJux6XgOQ==
+"@sapphire/async-queue@^1.1.8":
+ "integrity" "sha512-CbXaGwwlEMq+l1TRu01FJCvySJ1CEFKFclHT48nIfNeZXaAAmmwwy7scUKmYHPUa3GhoMp6Qr1B3eAJux6XgOQ=="
+ "resolved" "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.9.tgz"
+ "version" "1.1.9"
-"@sindresorhus/is@^4.0.1":
- version "4.2.0"
- resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.2.0.tgz#667bfc6186ae7c9e0b45a08960c551437176e1ca"
- integrity sha512-VkE3KLBmJwcCaVARtQpfuKcKv8gcBmUubrfHGF84dXuuW6jgsRYxPtzcIhPyK9WAPpRt2/xY6zkD9MnRaJzSyw==
+"@sindresorhus/is@^4.0.1", "@sindresorhus/is@^4.2.0":
+ "integrity" "sha512-VkE3KLBmJwcCaVARtQpfuKcKv8gcBmUubrfHGF84dXuuW6jgsRYxPtzcIhPyK9WAPpRt2/xY6zkD9MnRaJzSyw=="
+ "resolved" "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.0.tgz"
+ "version" "4.2.0"
"@types/node-fetch@^2.5.12":
- version "2.5.12"
- resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66"
- integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==
+ "integrity" "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw=="
+ "resolved" "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz"
+ "version" "2.5.12"
dependencies:
"@types/node" "*"
- form-data "^3.0.0"
+ "form-data" "^3.0.0"
"@types/node@*":
- version "16.11.9"
- resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.9.tgz#879be3ad7af29f4c1a5c433421bf99fab7047185"
- integrity sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A==
+ "integrity" "sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A=="
+ "resolved" "https://registry.npmjs.org/@types/node/-/node-16.11.9.tgz"
+ "version" "16.11.9"
"@types/ws@^8.2.0":
- version "8.2.0"
- resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.2.0.tgz#75faefbe2328f3b833cb8dc640658328990d04f3"
- integrity sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg==
+ "integrity" "sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg=="
+ "resolved" "https://registry.npmjs.org/@types/ws/-/ws-8.2.0.tgz"
+ "version" "8.2.0"
dependencies:
"@types/node" "*"
-asynckit@^0.4.0:
- version "0.4.0"
- resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
- integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
+"asynckit@^0.4.0":
+ "integrity" "sha1-x57Zf380y48robyXkLzDZkdLS3k="
+ "resolved" "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
+ "version" "0.4.0"
-callsites@^3.1.0:
- version "3.1.0"
- resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
- integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
+"callsites@^3.1.0":
+ "integrity" "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
+ "resolved" "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz"
+ "version" "3.1.0"
-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==
+"combined-stream@^1.0.8":
+ "integrity" "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="
+ "resolved" "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz"
+ "version" "1.0.8"
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-api-types@^0.22.0:
- version "0.22.0"
- resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.22.0.tgz#34dc57fe8e016e5eaac5e393646cd42a7e1ccc2a"
- integrity sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==
-
-discord-api-types@^0.23.1:
- version "0.23.1"
- resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.23.1.tgz#832d0ee2b3c8e2eae02947c1dbf38121d6d357d5"
- integrity sha512-igWmn+45mzXRWNEPU25I/pr8MwxHb767wAr51oy3VRLRcTlp5ADBbrBR0lq3SA1Rfw3MtM4TQu1xo3kxscfVdQ==
-
-discord.js@zfbx/discord.js:
- version "13.3.0-dev"
- resolved "https://codeload.github.com/zfbx/discord.js/tar.gz/45223966f46d221521ff24b6badd24de35d9bcf9"
+ "delayed-stream" "~1.0.0"
+
+"delayed-stream@~1.0.0":
+ "integrity" "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
+ "resolved" "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
+ "version" "1.0.0"
+
+"discord-api-types@^0.24.0":
+ "integrity" "sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A=="
+ "resolved" "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz"
+ "version" "0.24.0"
+
+"discord.js@^13.3.1":
+ "integrity" "sha512-zn4G8tL5+tMV00+0aSsVYNYcIfMSdT2g0nudKny+Ikd+XKv7m6bqI7n3Vji0GIRqXDr5ArPaw+iYFM2I1Iw3vg=="
+ "resolved" "https://registry.npmjs.org/discord.js/-/discord.js-13.3.1.tgz"
+ "version" "13.3.1"
dependencies:
- "@discordjs/builders" "^0.6.0"
- "@discordjs/collection" "^0.2.1"
+ "@discordjs/builders" "^0.8.1"
+ "@discordjs/collection" "^0.3.2"
"@discordjs/form-data" "^3.0.1"
- "@sapphire/async-queue" "^1.1.5"
+ "@sapphire/async-queue" "^1.1.8"
"@types/node-fetch" "^2.5.12"
"@types/ws" "^8.2.0"
- discord-api-types "^0.23.1"
- node-fetch "^2.6.1"
- ws "^8.2.3"
-
-dot-prop@^6.0.1:
- version "6.0.1"
- resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083"
- integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==
+ "discord-api-types" "^0.24.0"
+ "node-fetch" "^2.6.1"
+ "ws" "^8.2.3"
+
+"dot-prop@^6.0.1":
+ "integrity" "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA=="
+ "resolved" "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz"
+ "version" "6.0.1"
dependencies:
- is-obj "^2.0.0"
+ "is-obj" "^2.0.0"
-form-data@^3.0.0:
- version "3.0.1"
- resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
- integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==
+"form-data@^3.0.0":
+ "integrity" "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg=="
+ "resolved" "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz"
+ "version" "3.0.1"
dependencies:
- asynckit "^0.4.0"
- combined-stream "^1.0.8"
- mime-types "^2.1.12"
-
-is-obj@^2.0.0:
- version "2.0.0"
- resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982"
- integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==
-
-lodash.isequal@^4.5.0:
- version "4.5.0"
- resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
- integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=
-
-mime-db@1.51.0:
- version "1.51.0"
- resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c"
- integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==
-
-mime-types@^2.1.12:
- version "2.1.34"
- resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24"
- integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==
+ "asynckit" "^0.4.0"
+ "combined-stream" "^1.0.8"
+ "mime-types" "^2.1.12"
+
+"is-obj@^2.0.0":
+ "integrity" "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
+ "resolved" "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz"
+ "version" "2.0.0"
+
+"lodash.isequal@^4.5.0":
+ "integrity" "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
+ "resolved" "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz"
+ "version" "4.5.0"
+
+"mime-db@1.51.0":
+ "integrity" "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g=="
+ "resolved" "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz"
+ "version" "1.51.0"
+
+"mime-types@^2.1.12":
+ "integrity" "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A=="
+ "resolved" "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz"
+ "version" "2.1.34"
dependencies:
- mime-db "1.51.0"
+ "mime-db" "1.51.0"
-node-fetch@^2.6.1, node-fetch@^2.6.6:
- version "2.6.6"
- resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
- integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
+"node-fetch@^2.6.1", "node-fetch@^2.6.6":
+ "integrity" "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA=="
+ "resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz"
+ "version" "2.6.6"
dependencies:
- whatwg-url "^5.0.0"
+ "whatwg-url" "^5.0.0"
-ow@^0.27.0:
- version "0.27.0"
- resolved "https://registry.yarnpkg.com/ow/-/ow-0.27.0.tgz#d44da088e8184fa11de64b5813206f9f86ab68d0"
- integrity sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ==
+"ow@^0.27.0":
+ "integrity" "sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ=="
+ "resolved" "https://registry.npmjs.org/ow/-/ow-0.27.0.tgz"
+ "version" "0.27.0"
dependencies:
"@sindresorhus/is" "^4.0.1"
- callsites "^3.1.0"
- dot-prop "^6.0.1"
- lodash.isequal "^4.5.0"
- type-fest "^1.2.1"
- vali-date "^1.0.0"
-
-tr46@~0.0.3:
- version "0.0.3"
- resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
- integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=
-
-ts-mixer@^6.0.0:
- version "6.0.0"
- resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.0.tgz#4e631d3a36e3fa9521b973b132e8353bc7267f9f"
- integrity sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ==
-
-tslib@^2.3.1:
- version "2.3.1"
- resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
- integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
-
-type-fest@^1.2.1:
- version "1.4.0"
- resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1"
- integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==
-
-vali-date@^1.0.0:
- version "1.0.0"
- resolved "https://registry.yarnpkg.com/vali-date/-/vali-date-1.0.0.tgz#1b904a59609fb328ef078138420934f6b86709a6"
- integrity sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=
-
-webidl-conversions@^3.0.0:
- version "3.0.1"
- resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
- integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=
-
-whatwg-url@^5.0.0:
- version "5.0.0"
- resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
- integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
+ "callsites" "^3.1.0"
+ "dot-prop" "^6.0.1"
+ "lodash.isequal" "^4.5.0"
+ "type-fest" "^1.2.1"
+ "vali-date" "^1.0.0"
+
+"tr46@~0.0.3":
+ "integrity" "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
+ "resolved" "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz"
+ "version" "0.0.3"
+
+"ts-mixer@^6.0.0":
+ "integrity" "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
+ "resolved" "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz"
+ "version" "6.0.0"
+
+"tslib@^2.3.1":
+ "integrity" "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
+ "resolved" "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz"
+ "version" "2.3.1"
+
+"type-fest@^1.2.1":
+ "integrity" "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA=="
+ "resolved" "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz"
+ "version" "1.4.0"
+
+"vali-date@^1.0.0":
+ "integrity" "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY="
+ "resolved" "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz"
+ "version" "1.0.0"
+
+"webidl-conversions@^3.0.0":
+ "integrity" "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
+ "resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
+ "version" "3.0.1"
+
+"whatwg-url@^5.0.0":
+ "integrity" "sha1-lmRU6HZUYuN2RNNib2dCzotwll0="
+ "resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz"
+ "version" "5.0.0"
dependencies:
- tr46 "~0.0.3"
- webidl-conversions "^3.0.0"
+ "tr46" "~0.0.3"
+ "webidl-conversions" "^3.0.0"
-ws@^8.2.3:
- version "8.2.3"
- resolved "https://registry.yarnpkg.com/ws/-/ws-8.2.3.tgz#63a56456db1b04367d0b721a0b80cae6d8becbba"
- integrity sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA==
+"ws@^8.2.3":
+ "integrity" "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA=="
+ "resolved" "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz"
+ "version" "8.2.3"
From 4c93463d3f13ce3a7a21166ec68de0ab9b023bb6 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Sun, 21 Nov 2021 17:24:45 -0500
Subject: [PATCH 08/21] artifact 4890+ required
---
docs/faq.md | 6 +++---
fxmanifest.lua | 2 +-
readme.md | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/docs/faq.md b/docs/faq.md
index 6507556..a72b184 100644
--- a/docs/faq.md
+++ b/docs/faq.md
@@ -11,7 +11,7 @@ Here's a list of common problems people have run into and how to solve them. If
- [QBCore commands not showing](#qbcore-commands-not-showing)
- [Bot status message updates slow](#bot-status-message-updates-slow)
- [Buffer Deprecation Warning](#buffer-deprecation-warning)
-- [Could not find dependency /server:4800](#could-not-find-dependency-server4800)
+- [Could not find dependency /server:4890](#could-not-find-dependency-server4890)
- [QBCore commands aren't showing](#qbcore-commands-not-showing)
@@ -68,9 +68,9 @@ You may see a warning like:
This is fine.. it's just a warning that future versions may drop support for it. I don't see FiveM updating node again for quite some time so it's nothing to concern yourself with at the moment. This issue comes from a sub-dependency (node-fetch and whatwg) thinking FiveM is a browser so falling back to use `Buffer()`. I hope future updates of those resources will fix it, currently there's nothing I can do about it without forking entire collections of node modules and changing them. And I don't want the responsibility of keeping them updated especially when they're fairly active repositories.
-### Could not find dependency /server:4800
+### Could not find dependency /server:4890
-When trying to start zdiscord you get an error that says `Could not find dependency /server:4800 for resource zdiscord`. This means you aren't running [FiveM artifacts](https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/) version 4800 or later. updating to a version number higher than 4800 will fix this error and allow the resource to start.
+When trying to start zdiscord you get an error that says `Could not find dependency /server:4890 for resource zdiscord`. This means you aren't running [FiveM artifacts](https://runtime.fivem.net/artifacts/fivem/build_server_windows/master/) version 4890 or later. updating to a version number higher than 4890 will fix this error and allow the resource to start.
### QBCore commands aren't loading
diff --git a/fxmanifest.lua b/fxmanifest.lua
index 5026387..dfd2b36 100644
--- a/fxmanifest.lua
+++ b/fxmanifest.lua
@@ -23,6 +23,6 @@ server_script "server/server.js"
client_script "client/client.lua"
dependencies {
- '/server:4800', -- Node16+
+ '/server:4890', -- Node16+
'yarn',
}
diff --git a/readme.md b/readme.md
index 6df5b3f..ed48797 100644
--- a/readme.md
+++ b/readme.md
@@ -26,7 +26,7 @@ A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and
## Setup
### Requirements
-- FiveM artifacts build 4800 or higher
+- FiveM artifacts build 4890 or higher
- [cfx-server-data](https://github.com/citizenfx/cfx-server-data) in your resources (yarn (`[system]/[builders]/yarn/`) at least)
- Optional: [screenshot-basic](https://github.com/citizenfx/screenshot-basic) if you want the /screenshot command to work
From d3be9f6d5b532e0959fc8146d04babe67994d1cf Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Sun, 21 Nov 2021 21:14:32 -0500
Subject: [PATCH 09/21] nope, cfx still aint fixed their shit
---
package.json | 2 +-
yarn.lock | 7 +++----
2 files changed, 4 insertions(+), 5 deletions(-)
diff --git a/package.json b/package.json
index d902367..70c8e38 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,7 @@
},
"homepage": "https://github.com/zfbx/zdiscord",
"dependencies": {
- "discord.js": "^13.3.1",
+ "discord.js": "github:zfbx/discord.js",
"node-fetch": "^2.6.6"
},
"eslintConfig": {
diff --git a/yarn.lock b/yarn.lock
index 592c7e7..5d65eb4 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -84,10 +84,9 @@
"resolved" "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz"
"version" "0.24.0"
-"discord.js@^13.3.1":
- "integrity" "sha512-zn4G8tL5+tMV00+0aSsVYNYcIfMSdT2g0nudKny+Ikd+XKv7m6bqI7n3Vji0GIRqXDr5ArPaw+iYFM2I1Iw3vg=="
- "resolved" "https://registry.npmjs.org/discord.js/-/discord.js-13.3.1.tgz"
- "version" "13.3.1"
+"discord.js@github:zfbx/discord.js":
+ "resolved" "git+ssh://git@github.com/zfbx/discord.js.git#2c56b697c5515024600e59e09c42702170404ead"
+ "version" "13.4.0-dev"
dependencies:
"@discordjs/builders" "^0.8.1"
"@discordjs/collection" "^0.3.2"
From dfc7190628778fce284e4f093a28243207635782 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Mon, 22 Nov 2021 02:51:30 -0500
Subject: [PATCH 10/21] add new translation option
---
locales/ar.js | 1 +
locales/de.js | 1 +
locales/en.js | 1 +
locales/nl.js | 35 ++++++++++++++++++-----------------
locales/pl.js | 1 +
locales/tr.js | 5 +++--
locales/vn.js | 1 +
7 files changed, 26 insertions(+), 19 deletions(-)
diff --git a/locales/ar.js b/locales/ar.js
index c3b383b..76276e4 100644
--- a/locales/ar.js
+++ b/locales/ar.js
@@ -12,6 +12,7 @@ const locale = {
kickedWithoutReason: "لقد تم طردك من قبل المراقب.",
announcement: "اعلان",
directMessage: "الادارة",
+ staffchat: "شات الادارة",
};
module.exports = locale;
diff --git a/locales/de.js b/locales/de.js
index b27d5b6..f1c30ef 100644
--- a/locales/de.js
+++ b/locales/de.js
@@ -12,6 +12,7 @@ const locale = {
kickedWithoutReason: "Du wurdest vom Team gekickt.",
announcement: "ANNOUNCEMENT",
directMessage: "STAFF",
+ staffchat: "STAFFCHAT",
};
module.exports = locale;
diff --git a/locales/en.js b/locales/en.js
index ab541e6..67c0d3b 100644
--- a/locales/en.js
+++ b/locales/en.js
@@ -13,6 +13,7 @@ const locale = {
kickedWithoutReason: "You've been kicked by staff.",
announcement: "ANNOUNCEMENT",
directMessage: "STAFF",
+ staffchat: "STAFFCHAT",
};
module.exports = locale;
diff --git a/locales/nl.js b/locales/nl.js
index fe78511..ae8457c 100644
--- a/locales/nl.js
+++ b/locales/nl.js
@@ -1,17 +1,18 @@
-/*
- Translation strings used by the bot
- Strings wrapped in { } will be auto-replaced with updated values
- Globals: {servername}, {invite}, (all from config) and {playercount} (current connected players)
-*/
-const locale = {
- checkingWhitelist: "Hoi {name}, wij kijken na of je wel gewhitelist bent",
- discordNotOpen: "Je moet Discord open hebben staan voordat je FiveM opstart (Restart beiden als het probleem zich voordoet)",
- fatalError: "Iets ging verkeerd terwijl wij jouw whitelist status nakeken, gelieven even opnieuw te verbinden of contact met ons op te zoeken in discord",
- notInDiscordServer: "Je zit niet in de {servername} Discord, gelieve deze te joinen hier: {invite}",
- notWhitelisted: "Je hebt de benodigde {servername} Discord role niet om te joinen, ben je wel whitelisted?",
- kickedWithoutReason: "Je werd gekickt door staff.",
- announcement: "AANKONDIGING",
- directMessage: "STAFF",
-};
-
-module.exports = locale;
+/*
+ Translation strings used by the bot
+ Strings wrapped in { } will be auto-replaced with updated values
+ Globals: {servername}, {invite}, (all from config) and {playercount} (current connected players)
+*/
+const locale = {
+ checkingWhitelist: "Hoi {name}, wij kijken na of je wel gewhitelist bent",
+ discordNotOpen: "Je moet Discord open hebben staan voordat je FiveM opstart (Restart beiden als het probleem zich voordoet)",
+ fatalError: "Iets ging verkeerd terwijl wij jouw whitelist status nakeken, gelieven even opnieuw te verbinden of contact met ons op te zoeken in discord",
+ notInDiscordServer: "Je zit niet in de {servername} Discord, gelieve deze te joinen hier: {invite}",
+ notWhitelisted: "Je hebt de benodigde {servername} Discord role niet om te joinen, ben je wel whitelisted?",
+ kickedWithoutReason: "Je werd gekickt door staff.",
+ announcement: "AANKONDIGING",
+ directMessage: "STAFF",
+ staffchat: "STAFFCHAT",
+};
+
+module.exports = locale;
diff --git a/locales/pl.js b/locales/pl.js
index e0cef5e..703aef5 100644
--- a/locales/pl.js
+++ b/locales/pl.js
@@ -12,6 +12,7 @@ const locale = {
kickedWithoutReason: "Zostałeś wyrzucony przez administrację.",
announcement: "OGŁOSZENIE",
directMessage: "ADMINISTRACJA",
+ staffchat: "STAFFCHAT",
};
module.exports = locale;
diff --git a/locales/tr.js b/locales/tr.js
index ed5f434..bb514fd 100644
--- a/locales/tr.js
+++ b/locales/tr.js
@@ -10,8 +10,9 @@ const locale = {
notInDiscordServer: "{servername} Discord adresinizde bulunmuyorsunuz, katılmak için: {invite}",
notWhitelisted: "{servername} için whitelist rolünüz bulunmamakta.",
kickedWithoutReason: "Yetkili tarafından sunucudan atıldın.",
- announcement: "Duyuru",
- directMessage: "Yetkili",
+ announcement: "DUYURU",
+ directMessage: "PERSONEL",
+ staffchat: "PERSONELSOHBET",
};
module.exports = locale;
diff --git a/locales/vn.js b/locales/vn.js
index cb91e27..6c52aca 100644
--- a/locales/vn.js
+++ b/locales/vn.js
@@ -12,6 +12,7 @@ const locale = {
kickedWithoutReason: "Bạn Đã Bị Đuổi Bởi Quản Trị Viên.",
announcement: "Thông Báo",
directMessage: "Quản Trị Viên",
+ staffchat: "STAFFCHAT",
};
module.exports = locale;
From 2dfe4ce166b4b8ae2351fd18b0c6393166093d42 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Mon, 22 Nov 2021 02:53:39 -0500
Subject: [PATCH 11/21] staff chat and update replaceGlobals
---
readme.md | 6 ++++-
server/commands/kick.js | 2 +-
server/events/messageCreate.js | 2 +-
server/events/ready.js | 4 +--
server/server.js | 47 +++++++++++++++++-----------------
server/utils.js | 10 ++++----
6 files changed, 38 insertions(+), 33 deletions(-)
diff --git a/readme.md b/readme.md
index ed48797..f4f0ee2 100644
--- a/readme.md
+++ b/readme.md
@@ -45,7 +45,11 @@ A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and
6. In your `server.cfg` do the following:
6a. Add `ensure zdiscord` (after qb-core and/or [convars](https://zfbx.github.io/zdiscord/convars) you may have)
- 6b. Add `add_ace resource.zdiscord command allow` anywhere in the .cfg file
+ 6b. Add the following anywhere in your .cfg:
+ ```
+ add_ace resource.zdiscord command allow
+ add_ace group.zdiscordstaff zdiscord.staffchat allow
+ ```
7. Adjust the `config.js` variables to how you'd like them. (Optionally use [Convars](https://zfbx.github.io/zdiscord/convars))
diff --git a/server/commands/kick.js b/server/commands/kick.js
index c27f77d..9a753a8 100644
--- a/server/commands/kick.js
+++ b/server/commands/kick.js
@@ -32,7 +32,7 @@ module.exports = {
run: async (client, interaction, args) => {
if (!GetPlayerName(args.id)) return interaction.reply({ content: "This ID seems invalid.", ephemeral: true });
- const reason = client.utils.replaceGlobals(args.message || client.locale.kickedWithoutReason);
+ const reason = client.utils.replaceGlobals(client, args.message || client.locale.kickedWithoutReason);
DropPlayer(args.id, reason);
client.utils.log.info(`[${interaction.member.displayName}] Kicked ${GetPlayerName(args.id)} (${args.id}). Reason: ${reason}`);
return interaction.reply({ content: `${GetPlayerName(args.id)} (${args.id}) has been kicked.`, ephemeral: false });
diff --git a/server/events/messageCreate.js b/server/events/messageCreate.js
index 99d183d..29bf985 100644
--- a/server/events/messageCreate.js
+++ b/server/events/messageCreate.js
@@ -13,7 +13,7 @@ module.exports = {
name: "messageCreate",
// msg = https://discord.js.org/#/docs/main/stable/class/Message
run: async (client, msg) => {
- if (!msg.content || !client.QBCore || msg.author.bot) return;
+ if (!msg.content || msg.author.bot) return;
if (client.config.EnableStaffChatForwarding && msg.channel.id == client.config.DiscordStaffChannelId) {
client.utils.sendStaffChatMessage(client, msg.member.displayName, msg.content);
return console.log(`[STAFF] ${msg.member.displayName}: ${msg.content}`);
diff --git a/server/events/ready.js b/server/events/ready.js
index 9759174..74d1db7 100644
--- a/server/events/ready.js
+++ b/server/events/ready.js
@@ -37,10 +37,10 @@ module.exports = {
async function statusUpdater(client) {
setInterval(function() {
try {
- const msg = client.utils.replaceGlobals(config.BotStatusMessages[Math.floor(Math.random() * client.config.BotStatusMessages.length)]);
+ const msg = client.utils.replaceGlobals(client, client.config.BotStatusMessages[Math.floor(Math.random() * client.config.BotStatusMessages.length)]);
client.user.setActivity({ name: msg, type: "PLAYING" });
} catch (e) {
// Just gonna void these errors..
}
- }, 30000);
+ }, 20000);
}
diff --git a/server/server.js b/server/server.js
index 7063d78..48b6ca8 100644
--- a/server/server.js
+++ b/server/server.js
@@ -9,11 +9,6 @@
* or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
-/**
- * DO NOT EDIT THIS FILE UNLESS YOU KNOW WHAT YOU'RE DOING OR ARE
- * SUGGESTED TO DO SO BY SOMEONE WHO DOES. <3
- */
-
const z = {};
const fetch = require("node-fetch");
@@ -21,13 +16,14 @@ z.root = GetResourcePath(GetCurrentResourceName());
z.config = require(`${z.root}/config`);
z.locale = require(`${z.root}/locales/${z.config.LanguageLocaleCode}`);
z.utils = require(`${z.root}/server/utils`);
-z.config.staffChatDisabled = {};
const Bot = require(`${z.root}/server/bot`);
z.bot = new Bot(z);
-
if (z.config.EnableDiscordBot) z.bot.start();
+const Queue = require(`${z.root}/server/queue`);
+z.queue = new Queue(z);
+
SetConvarReplicated("zdiscord_servername", z.config.FiveMServerName);
SetConvarReplicated("zdiscord_discordinvite", z.config.DiscordInviteLink);
SetConvarReplicated("zdiscord_serverip", z.config.FiveMServerIP);
@@ -38,15 +34,15 @@ on("playerConnecting", async (name, setKickReason, deferrals) => {
if (!z.config.EnableWhitelistChecking || !z.config.EnableDiscordBot) return;
deferrals.defer();
await z.utils.sleep(0);
- deferrals.update(z.utils.replaceGlobals(z.locale.checkingWhitelist.replace(/{name}/g, name)));
+ deferrals.update(z.utils.replaceGlobals(z, z.locale.checkingWhitelist.replace(/{name}/g, name)));
await z.utils.sleep(0);
const discordID = z.utils.getPlayerDiscordId(player);
- if (!discordID) return deferrals.done(z.utils.replaceGlobals(z.locale.discordNotOpen));
+ if (!discordID) return deferrals.done(z.utils.replaceGlobals(z, z.locale.discordNotOpen));
const member = z.utils.getMember(z.bot, discordID);
- if (!member) return deferrals.done(z.utils.replaceGlobals(z.locale.notInDiscordServer));
+ if (!member) return deferrals.done(z.utils.replaceGlobals(z, z.locale.notInDiscordServer));
const whitelisted = z.utils.isRolePresent(z.bot, member, z.config.DiscordWhitelistRoleIds);
if (whitelisted) deferrals.done();
- else deferrals.done(z.utils.replaceGlobals(z.locale.notWhitelisted));
+ else deferrals.done(z.utils.replaceGlobals(z, z.locale.notWhitelisted));
});
global.exports("isRolePresent", (identifier, role) => {
@@ -77,7 +73,7 @@ on("playerJoining", (oldId) => {
}
}
if (z.utils.isRolePresent(z.bot, member, [ z.config.DiscordModRoleId, z.config.DiscordAdminRoleId, z.config.DiscordGodRoleId ])) {
- ExecuteCommand(`add_principal "player.${source}" "zdiscord.staffchat"`);
+ ExecuteCommand(`add_principal "player.${source}" group.zdiscordstaff`);
}
});
@@ -95,25 +91,28 @@ on("playerDropped", (reason) => {
if (z.config.EnableStaffChatForwarding) {
RegisterCommand("staff", (source, args, raw) => {
- if (z.config.staffChatDisabled[source]) return;
- z.utils.sendStaffChatMessage(z, GetPlayerName(source), raw);
+ if (!IsPlayerAceAllowed(source, "zdiscord.staffchat")) return;
+ z.utils.sendStaffChatMessage(z, GetPlayerName(source), raw.substring(6));
if (!z.config.EnableDiscordBot) return;
const staffChannel = z.bot.channels.cache.get(z.config.DiscordStaffChannelId);
if (!staffChannel) return z.utils.log.warn("DiscordStaffChannelId was not found, staff message not sent.");
- staffChannel.send({ content: `${GetPlayerName(source)}: ${raw}`, allowMentions: false });
+ staffChannel.send({ content: `${GetPlayerName(source)}: ${raw.substring(6)}`, allowMentions: false });
}, "zdiscord.staffchat");
RegisterCommand("stafftoggle", (source, args, raw) => {
- if (z.config.staffChatDisabled[source]) {
- z.config.staffChatDisabled[source] = false;
- emitNet("chat:addMessage", player, {
- template: "[server]: Staff Chat Enabled
",
- });
- } else {
- z.config.staffChatDisabled[source] = true;
- emitNet("chat:addMessage", player, {
+ if (IsPlayerAceAllowed(source, "zdiscord.staffchat")) {
+ ExecuteCommand(`remove_principal "player.${source}" group.zdiscordstaff`);
+ emitNet("chat:addMessage", source, {
template: "[server]: Staff Chat Disabled
",
});
+ } else {
+ const member = z.utils.getMemberFromSource(z.bot, source);
+ if (z.utils.isRolePresent(z.bot, member, [ z.config.DiscordModRoleId, z.config.DiscordAdminRoleId, z.config.DiscordGodRoleId ])) {
+ ExecuteCommand(`add_principal "player.${source}" group.zdiscordstaff`);
+ emitNet("chat:addMessage", source, {
+ template: "[server]: Staff Chat Enabled
",
+ });
+ }
}
}, "zdiscord.staffchat");
@@ -164,3 +163,5 @@ global.exports("log", async (type, message, pingRole, color) => {
}
return false;
});
+
+// add_principal "player.1" "zdiscord.staffchat" allow
diff --git a/server/utils.js b/server/utils.js
index 063e144..18a2aaf 100644
--- a/server/utils.js
+++ b/server/utils.js
@@ -141,10 +141,10 @@ exports.uppercaseFirstLetter = (string) => {
/** Replaces common global variables: {servername} {invite} {playercount}
* @param {string} string - string to be converted
* @return {string} - String with { variables } replaced */
-exports.replaceGlobals = (string) => {
+exports.replaceGlobals = (z, string) => {
return string
- .replace(/{servername}/g, config.FiveMServerName)
- .replace(/{invite}/g, config.DiscordInviteLink)
+ .replace(/{servername}/g, z.config.FiveMServerName)
+ .replace(/{invite}/g, z.config.DiscordInviteLink)
.replace(/{playercount}/g, GetNumPlayerIndices());
};
@@ -294,9 +294,9 @@ exports.isValidID = isValidID;
const sendStaffChatMessage = (client, name, msg) => {
if (!msg) return;
getPlayers().forEach(async function(player, index, array) {
- if (IsPlayerAceAllowed(player, "zdiscord.staffchat") && !client.config.staffChatDisabled[player]) {
+ if (IsPlayerAceAllowed(player, "zdiscord.staffchat")) {
emitNet("chat:addMessage", player, {
- template: `[staff] ${name}: ${msg}
`,
+ template: `[${client.locale.staffchat}] ${name}: ${msg}
`,
});
}
});
From f07fd417a2f009f7703d51306f4f6b9e7a629325 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Mon, 22 Nov 2021 02:53:56 -0500
Subject: [PATCH 12/21] docs to match new permission system
---
docs/commands.md | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/docs/commands.md b/docs/commands.md
index d55d896..6b6d4af 100644
--- a/docs/commands.md
+++ b/docs/commands.md
@@ -138,11 +138,11 @@ Adding commands can be really simple if you're familiar with javascript but very
### Add permission levels
-By defaults there is mod, admin and god but if you wanted to add another level, for like trial mods, it's actually quite easy to do. In `server.js`, at the bottom there's a section called `loadDiscordPermissions()`.
+By defaults there is mod, admin and god but if you wanted to add another level, for like trial mods, it's actually quite easy to do. In `bot.js`, at the bottom there's a section called `loadDiscordPermissions()`.
It has 2 main parts, The role levels, which look like `const mod = { id:..`
And the role table
```js
-config.perms = {
+this.config.perms = {
"mod": [ mod, admin, god, own ],
"admin": [ admin, god, own ], ...
```
@@ -153,7 +153,7 @@ const trialmod = { id: "000000000000000", type: 1, permission: true };
```
then you would add it to the role table with all the other roles you want to inherit permissions from trialmod:
```js
-config.perms = {
+this.config.perms = {
"trialmod": [ trialmod, mod, admin, god, own ],
"mod": [ mod, admin, god, own ], ...
```
@@ -164,13 +164,13 @@ Then in the command files for the commands you want trial mods to be able to acc
**Full example:**
```js
-function loadDiscordPermissions() {
- const mod = { id: config.DiscordModRoleId, type: 1, permission: true };
- const admin = { id: config.DiscordAdminRoleId, type: 1, permission: true };
- const god = { id: config.DiscordGodRoleId, type: 1, permission: true };
+loadDiscordPermissions() {
+ const mod = { id: this.config.DiscordModRoleId, type: 1, permission: true };
+ const admin = { id: this.config.DiscordAdminRoleId, type: 1, permission: true };
+ const god = { id: this.config.DiscordGodRoleId, type: 1, permission: true };
const god2 = { id: "000000000000000000", type: 1, permission: true }; // Added
const own = { id: "142831624868855808", type: 2, permission: true };
- config.perms = {
+ this.config.perms = {
"mod": [ mod, admin, god, god2, own ], // changed
"admin": [ admin, god, god2, own ], // changed
"god": [ god, god2, own ], // changed
From 034df90a8dc2768bba5b99f701cecb800791ef17 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Mon, 22 Nov 2021 02:54:06 -0500
Subject: [PATCH 13/21] unused
---
server/bot.js | 1 -
1 file changed, 1 deletion(-)
diff --git a/server/bot.js b/server/bot.js
index 5a5f6bb..c569abf 100644
--- a/server/bot.js
+++ b/server/bot.js
@@ -10,7 +10,6 @@
*/
const { Client, Collection, MessageEmbed } = require("discord.js");
-const root = GetResourcePath(GetCurrentResourceName());
const { readdirSync } = require("fs");
From 01c720067639b1f20e6d29d52048e60da14833ab Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Mon, 22 Nov 2021 02:54:59 -0500
Subject: [PATCH 14/21] new command, checkonline
---
server/commands/qb-user-checkonline.js | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 server/commands/qb-user-checkonline.js
diff --git a/server/commands/qb-user-checkonline.js b/server/commands/qb-user-checkonline.js
new file mode 100644
index 0000000..5d99f7e
--- /dev/null
+++ b/server/commands/qb-user-checkonline.js
@@ -0,0 +1,25 @@
+/**
+ * This file is part of zdiscord.
+ * Copyright (C) 2021 Tony/zfbx
+ * source:
+ *
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
+ */
+
+module.exports = {
+ name: "onlinecheck",
+ type: "USER",
+ default_permission: false,
+ role: "mod",
+
+ run: async (client, interaction, args) => {
+ const player = await client.utils.getPlayerFromDiscordId(interaction.targetId);
+ if (!player) return interaction.reply({ content: `<@${interaction.targetId}> is offline right now.`, ephemeral: true });
+ const qbplayer = client.QBCore.Functions.GetPlayer(parseInt(player));
+ if (!qbplayer) return interaction.reply({ content: `<@${interaction.targetId}> is online but not loaded in.`, ephemeral: true });
+ return interaction.reply({ content: `<@${interaction.targetId}> is online! Playing as ${qbplayer.PlayerData.charinfo.firstname} ${qbplayer.PlayerData.charinfo.lastname} (${qbplayer.PlayerData.citizenid})`, ephemeral: true });
+ },
+};
From 2cc472578342f5765bd112f3cf7e86ee7ea267e1 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Tue, 23 Nov 2021 02:33:38 -0500
Subject: [PATCH 15/21] major refactor/feature modules/classes
---
server/bot.js | 162 ++++++++++++++++++++++++++------
server/commands/announcement.js | 2 +-
server/commands/kick.js | 2 +-
server/commands/message.js | 2 +-
server/commands/players.js | 2 +-
server/commands/resource.js | 2 +-
server/commands/server.js | 2 +-
server/log.js | 65 +++++++++++++
server/queue.js | 24 +++++
server/server.js | 72 ++++----------
server/utils.js | 120 +----------------------
11 files changed, 249 insertions(+), 206 deletions(-)
create mode 100644 server/log.js
create mode 100644 server/queue.js
diff --git a/server/bot.js b/server/bot.js
index c569abf..8490196 100644
--- a/server/bot.js
+++ b/server/bot.js
@@ -9,7 +9,7 @@
* or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
*/
-const { Client, Collection, MessageEmbed } = require("discord.js");
+const { Client, Collection, MessageEmbed, MessageActionRow, MessageButton } = require("discord.js");
const { readdirSync } = require("fs");
@@ -21,19 +21,48 @@ class Bot extends Client {
fetchAllMembers: true,
messageCacheMaxSize: 10,
});
+ this.enabled = z.config.EnableDiscordBot;
+ this.z = z;
this.config = z.config;
this.utils = z.utils;
- this.locale = z.locale;
- this.root = z.root;
this.Embed = MessageEmbed;
this.commands = new Collection();
this.arrayOfCommands = [];
+
+ if (this.enabled) this.start();
+ }
+
+ start() {
+ this.utils.log.assert((process.version == "v12.13.0"), "You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of zdiscord");
+ this.utils.log.assert((this.config.DiscordBotToken == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
+ this.utils.log.assert((this.config.DiscordGuildId == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
+ this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordGuildId)), "Your DiscordGuildId doesn't seem correct");
+ this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordModRoleId)), "Your DiscordModRoleId doesn't seem correct");
+ this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordAdminRoleId)), "Your DiscordAdminRoleId doesn't seem correct");
+ this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordGodRoleId)), "Your DiscordGodRoleId doesn't seem correct");
+ this.utils.log.assert(this.config.EnableStaffChatForwarding && !(this.utils.isValidID(this.config.DiscordStaffChannelId)), "Your DiscordStaffChannelId doesn't seem correct");
+
+ this.loadDiscordPermissions();
+
+ try {
+ this.QBCore = global.exports["qb-core"].GetCoreObject();
+ if (this.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
+ } catch { this.QBCore = false; }
+
+ if (this.config.EnableDiscordSlashCommands) this.loadCommands();
+ this.loadEvents();
+
+ // this.on("debug", (debug) => this.utils.log.handler("log", debug));
+ this.on("warn", (warning) => this.utils.log.handler("warn", warning));
+ this.on("error", (error) => this.utils.log.handler("error", error));
+
+ this.login(this.config.DiscordBotToken).catch((e) => client.utils.log.handler("error", e));
}
loadCommands() {
- const commandFiles = readdirSync(`${z.root}/server/commands`).filter(file => file.endsWith(".js"));
+ const commandFiles = readdirSync(`${this.z.root}/server/commands`).filter(file => file.endsWith(".js"));
for (const file of commandFiles) {
- const command = require(`${z.root}/server/commands/${file}`);
+ const command = require(`${this.z.root}/server/commands/${file}`);
if (!command?.name) continue;
if (command.args || command.alias) {
utils.log.warn(`${file} is an v4 or later command and is not supported, upgrade it or remove it`);
@@ -51,39 +80,118 @@ class Bot extends Client {
}
loadEvents() {
- const eventFiles = readdirSync(`${z.root}/server/events`).filter(file => file.endsWith(".js"));
+ const eventFiles = readdirSync(`${this.z.root}/server/events`).filter(file => file.endsWith(".js"));
for (const file of eventFiles) {
- const event = require(`${z.root}/server/events/${file}`);
+ const event = require(`${this.z.root}/server/events/${file}`);
if (event.once) this.once(event.name, (...args) => event.run(this, ...args));
else this.on(event.name, (...args) => event.run(this, ...args));
}
}
- start() {
- this.utils.log.assert((process.version == "v12.13.0"), "You are running unsupported artifacts, download a newer artifact or revert to version 4.0.0 of zdiscord");
- this.utils.log.assert((this.config.DiscordBotToken == "CHANGE"), "This module requires a discord bot token to run. Check the config.js");
- this.utils.log.assert((this.config.DiscordGuildId == "000000000000000000"), "This resource requires a discord guildid to work properly. Check the config.js");
- this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordGuildId)), "Your DiscordGuildId doesn't seem correct");
- this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordModRoleId)), "Your DiscordModRoleId doesn't seem correct");
- this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordAdminRoleId)), "Your DiscordAdminRoleId doesn't seem correct");
- this.utils.log.assert(!(this.utils.isValidID(this.config.DiscordGodRoleId)), "Your DiscordGodRoleId doesn't seem correct");
- this.utils.log.assert(this.config.EnableStaffChatForwarding && !(this.utils.isValidID(this.config.DiscordStaffChannelId)), "Your DiscordStaffChannelId doesn't seem correct");
- this.loadDiscordPermissions();
+ /**
+ * Creates a pagination embed
+ * credit to https://github.com/ryzyx/discordjs-button-pagination
+ * @param {Interaction} interaction - the message interaction to react to
+ * @param {MessageEmbed[]} pages - array of embeds
+ * @param {MessageButton[]} buttonList - Must be 2 button objects
+ * @param {number} timeout - Optional length of time to allow responses
+ * @returns {Interaction} current page
+ */
+ async paginationEmbed(interaction, pages, buttonList, timeout = 120000) {
+ let page = 0;
+ const row = new MessageActionRow().addComponents(buttonList);
+ if (interaction.deferred == false) await interaction.deferReply();
+ const curPage = await interaction.editReply({
+ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)],
+ components: [row], fetchReply: true,
+ });
+ const filter = (i) => i.customId === buttonList[0].customId || i.customId === buttonList[1].customId;
+ const collector = await curPage.createMessageComponentCollector({ filter, time: timeout });
+ collector.on("collect", async (i) => {
+ switch (i.customId) {
+ case buttonList[0].customId:
+ page = page > 0 ? --page : pages.length - 1;
+ break;
+ case buttonList[1].customId:
+ page = page + 1 < pages.length ? ++page : 0;
+ break;
+ default:
+ break;
+ }
+ await i.deferUpdate();
+ await i.editReply({ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)], components: [row] });
+ collector.resetTimer();
+ });
+ collector.on("end", () => {
+ if (!curPage.deleted) {
+ const disabledRow = new MessageActionRow().addComponents(buttonList[0].setDisabled(true), buttonList[1].setDisabled(true));
+ curPage.edit({ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)], components: [disabledRow] });
+ }
+ });
+ return curPage;
+ }
- try {
- this.QBCore = global.exports["qb-core"].GetCoreObject();
- if (this.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
- } catch { this.QBCore = false; }
+ /** Get discord member object by userid
+ * @param {number} userid - discordid
+ * @returns {object|boolean} - discord member or false */
+ getMember(userid) {
+ const guild = this.guilds.cache.get(this.config.DiscordGuildId);
+ if (!guild) {
+ this.utils.log.error("Failed to fetch Discord server.");
+ return false;
+ }
+ return guild.members.cache.get(userid) || false;
+ }
- if (this.config.EnableDiscordSlashCommands) this.loadCommands();
- this.loadEvents();
+ /** Get discord member object by source
+ * @param {number} id - Player ID / source
+ * @returns {object|boolean} - discord member or false */
+ getMemberFromSource(id) {
+ const ids = this.utils.getPlayerIdentifiers(id);
+ if (!ids.discord) return false;
+ return this.getMember(ids.discord);
+ }
- // this.on("debug", (debug) => this.utils.log.handler("log", debug));
- this.on("warn", (warning) => this.utils.log.handler("warn", warning));
- this.on("error", (error) => this.utils.log.handler("error", error));
+ /** take any sort of identifier and try to parse a discord member from it
+ * @param {number|string|object} member - source | discordid | member object
+ * @returns {object|boolean} - discord member or false */
+ parseMember(member) {
+ if (!member || !this.enabled) return false;
+ if (typeof member === "number") {
+ return this.getMemberFromSource(member);
+ } else if (typeof member === "string") {
+ return this.getMember(member);
+ } else { return member || false; }
+ }
- this.login(this.config.DiscordBotToken).catch((e) => client.utils.log.handler("error", e));
+ /** Returns true if a role is found by id or array of ids
+ * @param {number|object|string} member - source | member | discordid
+ * @param {string|object} role - Role ID or Role IDs
+ * @returns {boolean} - true if role was found, false otherwise */
+ isRolePresent(member, role) {
+ if (!role || !member || !this.enabled) return false;
+ member = this.parseMember(member);
+ if (!member) return false;
+ if (typeof role === "object") {
+ let found = false;
+ role.forEach(function(item) {
+ if (member.roles.cache.has(item)) found = true;
+ });
+ return found;
+ } else {
+ return member.roles.cache.has(role);
+ }
+ }
+
+ /** get array of discord member roles by id
+ * @param {number|object|string} member - source | member | discordid
+ * @returns {Array} - array of role ids */
+ getMemberRoles(member) {
+ if (!member || !this.enabled) return [];
+ member = this.parseMember(member);
+ if (!member) return [];
+ return member.roles.cache.map(r => r.id);
}
loadDiscordPermissions() {
diff --git a/server/commands/announcement.js b/server/commands/announcement.js
index 2ca7d61..a2b2ab8 100644
--- a/server/commands/announcement.js
+++ b/server/commands/announcement.js
@@ -26,7 +26,7 @@ module.exports = {
run: async (client, interaction, args) => {
emitNet("chat:addMessage", -1, {
- template: `${client.locale.announcement}: ${args.message}
`,
+ template: `${client.z.locale.announcement}: ${args.message}
`,
});
client.utils.log.info(`[${interaction.member.displayName}] Announcement: ${args.message}`);
interaction.reply({ content: "Announcement Sent", ephemeral: false });
diff --git a/server/commands/kick.js b/server/commands/kick.js
index 9a753a8..32be8b2 100644
--- a/server/commands/kick.js
+++ b/server/commands/kick.js
@@ -32,7 +32,7 @@ module.exports = {
run: async (client, interaction, args) => {
if (!GetPlayerName(args.id)) return interaction.reply({ content: "This ID seems invalid.", ephemeral: true });
- const reason = client.utils.replaceGlobals(client, args.message || client.locale.kickedWithoutReason);
+ const reason = client.utils.replaceGlobals(client, args.message || client.z.locale.kickedWithoutReason);
DropPlayer(args.id, reason);
client.utils.log.info(`[${interaction.member.displayName}] Kicked ${GetPlayerName(args.id)} (${args.id}). Reason: ${reason}`);
return interaction.reply({ content: `${GetPlayerName(args.id)} (${args.id}) has been kicked.`, ephemeral: false });
diff --git a/server/commands/message.js b/server/commands/message.js
index 47a9e83..0d8ce9c 100644
--- a/server/commands/message.js
+++ b/server/commands/message.js
@@ -33,7 +33,7 @@ module.exports = {
run: async (client, interaction, args) => {
if (!GetPlayerName(args.id)) return interaction.reply({ content: "This ID seems invalid.", ephemeral: true });
emitNet("chat:addMessage", args.id, {
- template: `${client.locale.directMessage}: ${args.message}
`,
+ template: `${client.z.locale.directMessage}: ${args.message}
`,
});
client.utils.log.info(`[${interaction.member.displayName}] sent a DM to ${GetPlayerName(args.id)} (${args.id}): ${args.message}`);
return interaction.reply({ content: `Message sent to ${GetPlayerName(args.id)} (${args.id}).`, ephemeral: false });
diff --git a/server/commands/players.js b/server/commands/players.js
index 96229f9..39847f1 100644
--- a/server/commands/players.js
+++ b/server/commands/players.js
@@ -42,6 +42,6 @@ module.exports = {
});
const backBtn = new MessageButton().setCustomId("previousbtn").setEmoji("🔺").setStyle("SECONDARY");
const forwardBtn = new MessageButton().setCustomId("nextbtn").setEmoji("🔻").setStyle("SECONDARY");
- client.utils.paginationEmbed(interaction, pages, [backBtn, forwardBtn]);
+ client.paginationEmbed(interaction, pages, [backBtn, forwardBtn]);
},
};
diff --git a/server/commands/resource.js b/server/commands/resource.js
index 13010d5..4da31e9 100644
--- a/server/commands/resource.js
+++ b/server/commands/resource.js
@@ -128,7 +128,7 @@ module.exports = {
});
const backBtn = new MessageButton().setCustomId("previousbtn").setEmoji("🔺").setStyle("SECONDARY");
const forwardBtn = new MessageButton().setCustomId("nextbtn").setEmoji("🔻").setStyle("SECONDARY");
- client.utils.paginationEmbed(interaction, pages, [backBtn, forwardBtn]);
+ client.paginationEmbed(interaction, pages, [backBtn, forwardBtn]);
}
},
};
diff --git a/server/commands/server.js b/server/commands/server.js
index 17c0932..f587a5c 100644
--- a/server/commands/server.js
+++ b/server/commands/server.js
@@ -16,7 +16,7 @@ module.exports = {
// role: "mod",
run: async (client, interaction) => {
- if (client.utils.isRolePresent(client, interaction.member, [client.config.DiscordModRoleId, client.config.DiscordAdminRoleId, client.config.DiscordGodRoleId])) {
+ if (client.isRolePresent(interaction.member, [client.config.DiscordModRoleId, client.config.DiscordAdminRoleId, client.config.DiscordGodRoleId])) {
const embed = new client.Embed()
.setThumbnail(interaction.guild.iconURL({ format: "png", size: 512 }))
.addField("FiveM Server:", `**Version:** ${GetConvar("version", "Unknown")}
diff --git a/server/log.js b/server/log.js
new file mode 100644
index 0000000..0b9069b
--- /dev/null
+++ b/server/log.js
@@ -0,0 +1,65 @@
+/**
+ * This file is part of zdiscord.
+ * Copyright (C) 2021 Tony/zfbx
+ * source:
+ *
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
+ */
+
+const fetch = require("node-fetch");
+
+class Log {
+ constructor(z) {
+ this.z = z;
+ this.enabled = z.config.EnableLoggingWebhooks;
+ this.hooks = z.config.LoggingWebhooks;
+
+ if (this.enabled) {
+ StopResource("qb-logs");
+ }
+ }
+
+ /** Sends a log through to a webhook by name configured in config
+ * @param {string} type - type of log/event to pick which webhook to send
+ * @param {string} message - Message to log
+ * @param {boolean} pingRole - Whether message should ping configured role
+ * @param {string|number} color - [optional] color to have on the embed
+ * @returns {boolean} - success or failure of logging event */
+ async send(type, message, pingRole, color) {
+ if (!this.enabled) return false;
+ if (!message || !type) {
+ this.z.utils.log.error("[WEBHOOK FAIL] Log without message or type not permitted");
+ return false;
+ }
+ if (!this.z.config.LoggingWebhooks[type]) {
+ this.z.utils.log.error(`[WEBHOOK FAIL] "${type}" is not defined. Message: ${message}`);
+ return false;
+ }
+ const params = {
+ username: this.z.config.LoggingWebhookName,
+ embeds: [
+ {
+ "description": message,
+ "color": (color || "#1e90ff"),
+ },
+ ],
+ };
+ if (pingRole) params.content = `<@&${this.z.config.LoggingAlertPingRoleId}>`;
+ const reply = await fetch(z.config.LoggingWebhooks[type], {
+ method: "POST",
+ headers: { "Content-type": "application/json" },
+ body: JSON.stringify(params),
+ });
+ if (!reply.ok) {
+ this.z.utils.log.error(`[WEBHOOK FAIL] ${type.toLowerCase()} log failed. Message: ${message}. Error: ${reply.status}`);
+ return false;
+ }
+ return true;
+ }
+
+}
+
+module.exports = Log;
diff --git a/server/queue.js b/server/queue.js
new file mode 100644
index 0000000..da08d68
--- /dev/null
+++ b/server/queue.js
@@ -0,0 +1,24 @@
+/**
+ * This file is part of zdiscord.
+ * Copyright (C) 2021 Tony/zfbx
+ * source:
+ *
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
+ */
+
+class Queue {
+ constructor(z) {
+ this.connections = {};
+
+ if (z.config.EnableConnectingQueue) {
+ StopResource("hardcap");
+ StopResource("connectqueue");
+ }
+ }
+}
+
+
+module.exports = Queue;
diff --git a/server/server.js b/server/server.js
index 48b6ca8..db6bfae 100644
--- a/server/server.js
+++ b/server/server.js
@@ -10,7 +10,6 @@
*/
const z = {};
-const fetch = require("node-fetch");
z.root = GetResourcePath(GetCurrentResourceName());
z.config = require(`${z.root}/config`);
@@ -18,11 +17,12 @@ z.locale = require(`${z.root}/locales/${z.config.LanguageLocaleCode}`);
z.utils = require(`${z.root}/server/utils`);
const Bot = require(`${z.root}/server/bot`);
-z.bot = new Bot(z);
-if (z.config.EnableDiscordBot) z.bot.start();
-
const Queue = require(`${z.root}/server/queue`);
+const Log = require(`${z.root}/server/log`);
+
+z.bot = new Bot(z);
z.queue = new Queue(z);
+z.log = new Log(z);
SetConvarReplicated("zdiscord_servername", z.config.FiveMServerName);
SetConvarReplicated("zdiscord_discordinvite", z.config.DiscordInviteLink);
@@ -38,41 +38,38 @@ on("playerConnecting", async (name, setKickReason, deferrals) => {
await z.utils.sleep(0);
const discordID = z.utils.getPlayerDiscordId(player);
if (!discordID) return deferrals.done(z.utils.replaceGlobals(z, z.locale.discordNotOpen));
- const member = z.utils.getMember(z.bot, discordID);
+ const member = z.bot.getMember(discordID);
if (!member) return deferrals.done(z.utils.replaceGlobals(z, z.locale.notInDiscordServer));
- const whitelisted = z.utils.isRolePresent(z.bot, member, z.config.DiscordWhitelistRoleIds);
+ const whitelisted = z.bot.isRolePresent(member, z.config.DiscordWhitelistRoleIds);
if (whitelisted) deferrals.done();
else deferrals.done(z.utils.replaceGlobals(z, z.locale.notWhitelisted));
});
global.exports("isRolePresent", (identifier, role) => {
- if (!z.config.EnableDiscordBot) return false;
- return z.utils.isRolePresent(z.bot, identifier, role);
+ return z.bot.isRolePresent(identifier, role);
});
global.exports("getRoles", (identifier) => {
- if (!z.config.EnableDiscordBot) return false;
- return z.utils.getMemberRoles(z.bot, identifier);
+ return z.bot.getMemberRoles(identifier);
});
global.exports("getName", (identifier) => {
- if (!z.config.EnableDiscordBot) return false;
- const member = z.utils.parseMember(z.bot, identifier);
+ const member = z.bot.parseMember(identifier);
return member.displayName || false;
});
on("playerJoining", (oldId) => {
const source = global.source;
if (!z.config.EnableDiscordBot) return;
- const member = z.utils.getMemberFromSource(z.bot, source);
+ const member = z.bot.getMemberFromSource(source);
if (z.config.EnableAutoAcePermissions) {
for (const [perm, role] of Object.entries(z.config.AutoAcePermissions)) {
- if (z.utils.isRolePresent(z.bot, member, role)) {
+ if (z.bot.isRolePresent(member, role)) {
ExecuteCommand(`add_principal "player.${source}" "${perm}"`);
}
}
}
- if (z.utils.isRolePresent(z.bot, member, [ z.config.DiscordModRoleId, z.config.DiscordAdminRoleId, z.config.DiscordGodRoleId ])) {
+ if (z.bot.isRolePresent(member, [ z.config.DiscordModRoleId, z.config.DiscordAdminRoleId, z.config.DiscordGodRoleId ])) {
ExecuteCommand(`add_principal "player.${source}" group.zdiscordstaff`);
}
});
@@ -106,8 +103,8 @@ if (z.config.EnableStaffChatForwarding) {
template: "[server]: Staff Chat Disabled
",
});
} else {
- const member = z.utils.getMemberFromSource(z.bot, source);
- if (z.utils.isRolePresent(z.bot, member, [ z.config.DiscordModRoleId, z.config.DiscordAdminRoleId, z.config.DiscordGodRoleId ])) {
+ const member = z.bot.getMemberFromSource(source);
+ if (z.bot.isRolePresent(member, [ z.config.DiscordModRoleId, z.config.DiscordAdminRoleId, z.config.DiscordGodRoleId ])) {
ExecuteCommand(`add_principal "player.${source}" group.zdiscordstaff`);
emitNet("chat:addMessage", source, {
template: "[server]: Staff Chat Enabled
",
@@ -124,44 +121,7 @@ if (z.config.EnableStaffChatForwarding) {
});
}
-/** Sends a log through to a webhook by name configured in config
- * @param {string} type - type of log/event to pick which webhook to send
- * @param {string} message - Message to log
- * @param {boolean} pingRole - Whether message should ping configured role
- * @param {string|number} color - [optional] color to have on the embed
- * @returns {boolean} - success or failure of logging event */
+
global.exports("log", async (type, message, pingRole, color) => {
- if (z.config.EnableLoggingWebhooks) {
- if (!message || !type) {
- z.utils.log.error("[WEBHOOK FAIL] Log without message or type not permitted");
- return false;
- }
- if (!z.config.LoggingWebhooks[type]) {
- z.utils.log.error(`[WEBHOOK FAIL] "${type}" is not defined. Message: ${message}`);
- return false;
- }
- const params = {
- username: z.config.LoggingWebhookName,
- embeds: [
- {
- "description": message,
- "color": "#1e90ff",
- },
- ],
- };
- if (pingRole) params.content = `<@&${z.config.LoggingAlertPingRoleId}>`;
- const reply = await fetch(z.config.LoggingWebhooks[type], {
- method: "POST",
- headers: { "Content-type": "application/json" },
- body: JSON.stringify(params),
- });
- if (!reply.ok) {
- z.utils.log.error(`[WEBHOOK FAIL] ${type.toLowerCase()} log failed. Message: ${message}. Error: ${reply.status}`);
- return false;
- }
- return true;
- }
- return false;
+ return z.log.send(type, message, pingRole, color);
});
-
-// add_principal "player.1" "zdiscord.staffchat" allow
diff --git a/server/utils.js b/server/utils.js
index 18a2aaf..785b8c5 100644
--- a/server/utils.js
+++ b/server/utils.js
@@ -25,6 +25,7 @@ const getPlayerIdentifiers = (id) => {
};
exports.getPlayerIdentifiers = getPlayerIdentifiers;
+
/** Get player's discord id from source
* @param {number} id - Player ID to get identifiers from
* @returns {string|boolean} - discord id or false */
@@ -34,6 +35,7 @@ const getPlayerDiscordId = (id) => {
};
exports.getPlayerDiscordId = getPlayerDiscordId;
+
/** Get player source from discord id
* @param {string} discordid - Discord ID
* @returns {string|boolean} - source or false */
@@ -51,76 +53,6 @@ const getPlayerFromDiscordId = async (discordid) => {
};
exports.getPlayerFromDiscordId = getPlayerFromDiscordId;
-/** Get discord member object by userid
- * @param {object} client - discord client
- * @param {number} userid - discordid
- * @returns {object|boolean} - discord member or false */
-const getMember = (client, userid) => {
- const guild = client.guilds.cache.get(client.config.DiscordGuildId);
- if (!guild) {
- client.utils.log.error("Failed to fetch Discord server.");
- return false;
- }
- return guild.members.cache.get(userid) || false;
-};
-exports.getMember = getMember;
-
-
-/** Get discord member object by source
- * @param {object} client - discord client
- * @param {number} id - Player ID / source
- * @returns {object|boolean} - discord member or false */
-const getMemberFromSource = (client, id) => {
- const ids = getPlayerIdentifiers(id);
- if (!ids.discord) return false;
- return getMember(client, ids.discord);
-};
-exports.getMemberFromSource = getMemberFromSource;
-
-
-/** take any sort of identifier and try to parse a discord member from it
- * @param {object} client - discord client
- * @param {number|string|object} member - source | discordid | member object
- * @returns {object|boolean} - discord member or false */
-const parseMember = (client, member) => {
- if (typeof member === "number") {
- return getMemberFromSource(client, member);
- } else if (typeof member === "string") {
- return getMember(client, member);
- } else { return member || false; }
-};
-exports.parseMember = parseMember;
-
-
-/** Returns true if a role is found by id or array of ids
- * @param {object} client - discord client
- * @param {number|object|string} member - source | member | discordid
- * @param {string|object} role - Role ID or Role IDs
- * @returns {boolean} - true if role was found, false otherwise */
-exports.isRolePresent = (client, member, role) => {
- member = parseMember(client, member);
- if (!member) return false;
- if (typeof role === "object") {
- let found = false;
- role.forEach(function(item) {
- if (member.roles.cache.has(item)) found = true;
- });
- return found;
- } else {
- return member.roles.cache.has(role);
- }
-};
-
-/** get array of discord member roles by id
- * @param {object} client - discord client
- * @param {number|object|string} member - source | member | discordid
- * @returns {Array} - array of role ids */
-exports.getMemberRoles = (client, member) => {
- member = parseMember(client, member);
- if (!member) return [];
- return member.roles.cache.map(r => r.id);
-};
-
/** Await a set number of miliseconds as a promise for clean 1 line pauses
* @param {number} ms - number of miliseconds to wait
@@ -232,52 +164,6 @@ const log = {
exports.log = log;
-const { MessageActionRow, MessageEmbed, MessageButton } = require("discord.js");
-/**
- * Creates a pagination embed
- * credit to https://github.com/ryzyx/discordjs-button-pagination
- * @param {Interaction} interaction - the message interaction to react to
- * @param {MessageEmbed[]} pages - array of embeds
- * @param {MessageButton[]} buttonList - Must be 2 button objects
- * @param {number} timeout - Optional length of time to allow responses
- * @returns {Interaction} current page
- */
-const paginationEmbed = async (interaction, pages, buttonList, timeout = 120000) => {
- let page = 0;
- const row = new MessageActionRow().addComponents(buttonList);
- if (interaction.deferred == false) await interaction.deferReply();
- const curPage = await interaction.editReply({
- embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)],
- components: [row], fetchReply: true,
- });
- const filter = (i) => i.customId === buttonList[0].customId || i.customId === buttonList[1].customId;
- const collector = await curPage.createMessageComponentCollector({ filter, time: timeout });
- collector.on("collect", async (i) => {
- switch (i.customId) {
- case buttonList[0].customId:
- page = page > 0 ? --page : pages.length - 1;
- break;
- case buttonList[1].customId:
- page = page + 1 < pages.length ? ++page : 0;
- break;
- default:
- break;
- }
- await i.deferUpdate();
- await i.editReply({ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)], components: [row] });
- collector.resetTimer();
- });
- collector.on("end", () => {
- if (!curPage.deleted) {
- const disabledRow = new MessageActionRow().addComponents(buttonList[0].setDisabled(true), buttonList[1].setDisabled(true));
- curPage.edit({ embeds: [pages[page].setFooter(`Page ${page + 1} / ${pages.length}`)], components: [disabledRow] });
- }
- });
- return curPage;
-};
-exports.paginationEmbed = paginationEmbed;
-
-
/** Check if role or server id looks at least somewhat correct
* @param {string} id - role id
* @returns {boolean} - whether ID looks correct */
@@ -296,7 +182,7 @@ const sendStaffChatMessage = (client, name, msg) => {
getPlayers().forEach(async function(player, index, array) {
if (IsPlayerAceAllowed(player, "zdiscord.staffchat")) {
emitNet("chat:addMessage", player, {
- template: `[${client.locale.staffchat}] ${name}: ${msg}
`,
+ template: `[${client.z.locale.staffchat}] ${name}: ${msg}
`,
});
}
});
From ea544c881694ed499b32cc64c6bd49a4eb868485 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Wed, 8 Dec 2021 08:10:35 -0500
Subject: [PATCH 16/21] webhook logging is now an addon module
---
server/addons/log.js | 70 ++++++++++++++++++++++++++++++++++++++++++++
server/log.js | 65 ----------------------------------------
2 files changed, 70 insertions(+), 65 deletions(-)
create mode 100644 server/addons/log.js
delete mode 100644 server/log.js
diff --git a/server/addons/log.js b/server/addons/log.js
new file mode 100644
index 0000000..c7cba18
--- /dev/null
+++ b/server/addons/log.js
@@ -0,0 +1,70 @@
+/**
+ * This file is part of zdiscord.
+ * Copyright (C) 2021 Tony/zfbx
+ * source:
+ *
+ * This work is licensed under the Creative Commons
+ * Attribution-NonCommercial-ShareAlike 4.0 International License.
+ * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
+ * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
+ */
+
+const { MessageEmbed, WebhookClient } = require("discord.js");
+
+class Log {
+ constructor(z) {
+ this.z = z;
+ this.enabled = z.config.EnableLoggingWebhooks;
+ this.hooks = {};
+
+ if (this.enabled) {
+ StopResource("qb-logs");
+ let count = 0;
+ Object.entries(z.config.LoggingWebhooks).forEach(entry => {
+ const [key, value] = entry;
+ const k = key.toLocaleLowerCase();
+ if (this.hooks[k]) return client.z.utils.log.write(`Webhook for ${k} has already been registered. Remove the duplicate key`, { tag: "WEBHOOK", error: true });
+ const id = value.split("/").at(-2);
+ const token = value.split("/").at(-1);
+ if (id.length < 16 || id.length > 28 || token.length < 50 || token.length > 80) {
+ return this.z.utils.log.write(`Webhook for ${k} seems to be incorrect, check it's value.`, { tag: "WEBHOOK", error: true });
+ }
+ this.hooks[k] = new WebhookClient({ id: id, token: token, url: value });
+ count++;
+ });
+ this.z.utils.log.info(`${count} webhooks loaded.`, { tag: "WEBHOOK" });
+ }
+ global.exports("log", async (type, message, pingRole, color) => {
+ return z.log.send(type, message, { pingRole: pingRole, color: color });
+ });
+ }
+
+ /** Sends a log through to a webhook by name configured in config
+ * @param {string} type - type of log/event to pick which webhook to send
+ * @param {string} message - Message to log
+ * @param {boolean} pingRole - Whether message should ping configured role
+ * @param {object} options - pingRole, color, username, pingId
+ * @returns {boolean} - success or failure of logging event */
+ async send(type, message, options) {
+ if (!this.enabled) return false;
+ if (!message || !type) return this.z.utils.log.write("Log without message or type not permitted", { tag: "WEBHOOK", error: true });
+
+ const hook = this.hooks[type.toLocaleLowerCase()];
+ if (!hook) return this.z.utils.log.wrrite(`Webhook "${type}" is not defined. Message: ${message}`, { tag: "WEBHOOK", error: true });
+
+ const embed = new MessageEmbed().setDescription(message).setColor(options.color || "#1e90ff");
+ const data = {
+ username: options.username || this.z.config.LoggingWebhookName,
+ embeds: [ embed ],
+ };
+ if (options.pingRole) data.content = `<@${options.pingId || this.z.config.LoggingAlertPingId}>`;
+
+ await hook.send(data).catch((e) => {
+ return this.z.utils.log.write(`${type.toLowerCase()} log failed. Message: ${message}. Error: ${reply.status}`, { tag: "WEBHOOK", error: true });
+ });
+ return true;
+ }
+
+}
+
+module.exports = Log;
diff --git a/server/log.js b/server/log.js
deleted file mode 100644
index 0b9069b..0000000
--- a/server/log.js
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * This file is part of zdiscord.
- * Copyright (C) 2021 Tony/zfbx
- * source:
- *
- * This work is licensed under the Creative Commons
- * Attribution-NonCommercial-ShareAlike 4.0 International License.
- * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
- * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
- */
-
-const fetch = require("node-fetch");
-
-class Log {
- constructor(z) {
- this.z = z;
- this.enabled = z.config.EnableLoggingWebhooks;
- this.hooks = z.config.LoggingWebhooks;
-
- if (this.enabled) {
- StopResource("qb-logs");
- }
- }
-
- /** Sends a log through to a webhook by name configured in config
- * @param {string} type - type of log/event to pick which webhook to send
- * @param {string} message - Message to log
- * @param {boolean} pingRole - Whether message should ping configured role
- * @param {string|number} color - [optional] color to have on the embed
- * @returns {boolean} - success or failure of logging event */
- async send(type, message, pingRole, color) {
- if (!this.enabled) return false;
- if (!message || !type) {
- this.z.utils.log.error("[WEBHOOK FAIL] Log without message or type not permitted");
- return false;
- }
- if (!this.z.config.LoggingWebhooks[type]) {
- this.z.utils.log.error(`[WEBHOOK FAIL] "${type}" is not defined. Message: ${message}`);
- return false;
- }
- const params = {
- username: this.z.config.LoggingWebhookName,
- embeds: [
- {
- "description": message,
- "color": (color || "#1e90ff"),
- },
- ],
- };
- if (pingRole) params.content = `<@&${this.z.config.LoggingAlertPingRoleId}>`;
- const reply = await fetch(z.config.LoggingWebhooks[type], {
- method: "POST",
- headers: { "Content-type": "application/json" },
- body: JSON.stringify(params),
- });
- if (!reply.ok) {
- this.z.utils.log.error(`[WEBHOOK FAIL] ${type.toLowerCase()} log failed. Message: ${message}. Error: ${reply.status}`);
- return false;
- }
- return true;
- }
-
-}
-
-module.exports = Log;
From bac4fc6d0f5f70183e0f2a7f6ab9bb30feb9fdff Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Wed, 8 Dec 2021 08:12:20 -0500
Subject: [PATCH 17/21] fixes, QoL updates, cleanup, refactoring
---
config.js | 42 ++++--------------------
docs/config.md | 7 ++--
server/bot.js | 7 +---
server/events/messageCreate.js | 4 +--
server/queue.js | 24 --------------
server/server.js | 60 ++++++++++++++++++++--------------
server/utils.js | 8 +++--
7 files changed, 53 insertions(+), 99 deletions(-)
delete mode 100644 server/queue.js
diff --git a/config.js b/config.js
index ec8504f..c59d397 100644
--- a/config.js
+++ b/config.js
@@ -50,9 +50,6 @@ const BotStatusMessages = [
// ACE PERMISSIONS
const EnableAutoAcePermissions = false;
const AutoAcePermissions = {
- "group.god": DiscordGodRoleId,
- "group.admin": DiscordAdminRoleId,
- "group.mod": DiscordModRoleId,
// "example": "000000000000000000",
// "example2": [ "000000000000000000", "000000000000000000"],
};
@@ -67,40 +64,16 @@ const SaveScreenshotsToServer = false;
const EnableLoggingWebhooks = false;
const LoggingWebhookName = "zLogs";
-const LoggingAlertPingRoleId = "000000000000000000";
+// put "&" in front of the id if you're to ping a role
+const LoggingAlertPingId = "&000000000000000000";
// example: "bank": "https://discord.com/webhook/...",
const LoggingWebhooks = {
- "example": "",
+ "example": "https://discord.com/api/webhooks/000000000/sEcRRet-ToK3n_5tUfF_tH8t_YUo-S40u1d-n07-sHar3",
+ "test": "https://discord.com/api/webhooks/912921715854704670/1jJ0UJ2MTdDjqcYPa-UNA2rK_kzGZlcHPyfjyFnyh0BH1paP4TPlj-kGavyGuuPb-8wc",
+ "test2": "https://discord.com/api/webhooks/912921913427386420/yW8qoGNDtlxCrCsKK9vJLyVLwMCc0BukcTe7wPSgaBPxSgph_wVnvNjjJ4ew6TZhAPyy",
};
-/** *************************
- * CONNECTION QUEUE SETTINGS (( WIP ))
- ***************************/
-
-// WIP
-const EnableConnectingQueue = false;
-
-// WIP
-// This setting will only take effect if EnableDiscordBot is "true"
-const ConnectingQueuePriorities = {
- 1: DiscordGodRoleId,
- 2: DiscordAdminRoleId,
- 3: DiscordModRoleId,
- // 10: "000000000000000000",
- // 20: [ "000000000000000000", "000000000000000000"],
-};
-
-
-/** **********************
- * USER PRESENCE SETTINGS (( WIP ))
- *************************/
-
-// WIP
-const EnableUserPresenceUpdates = false;
-
-
-
/** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !! DO NOT EDIT BELOW THIS LINE UNLESS YOU KNOW WHAT YOU'RE DOING !!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/
@@ -126,12 +99,9 @@ module.exports = {
EnableAutoAcePermissions: getConBool("discord_enable_ace_perms", EnableAutoAcePermissions),
AutoAcePermissions: AutoAcePermissions,
SaveScreenshotsToServer: getConBool("discord_save_screenshots", SaveScreenshotsToServer),
- EnableConnectingQueue: getConBool("discord_enable_connecting_queue", EnableConnectingQueue),
- ConnectingQueuePriorities: ConnectingQueuePriorities,
DiscordStaffChannelId: GetConvar("discord_staff_channel_id", DiscordStaffChannelId),
- EnableUserPresenceUpdates: getConBool("discord_enable_user_presence", EnableUserPresenceUpdates),
LoggingWebhooks: LoggingWebhooks,
- LoggingAlertPingRoleId: GetConvar("discord_logging_alert_role", LoggingAlertPingRoleId),
+ LoggingAlertPingId: GetConvar("discord_logging_ping_id", LoggingAlertPingId),
LoggingWebhookName: GetConvar("discord_logging_name", LoggingWebhookName),
};
diff --git a/docs/config.md b/docs/config.md
index 90a466f..2479134 100644
--- a/docs/config.md
+++ b/docs/config.md
@@ -142,9 +142,10 @@ This setting enables the abilty to use the log export. if this is set to false t
**[ Convar: `discord_logging_name` ]**
This is the name to display in discord when the logs come through. Webhooks work slightly different from the normal bot and can have their own names or pictures set without issue, these "bots" however can't read messages or show up in the user list, it's just a one way message
-### LoggingAlertPingRoleId
-**[ Convar: `discord_logging_alert_role` ]**
-This discord id will be pingged in the event a log is sent with `true` for pingRole. This can be used to give attention to an important log that a dedicated staff team might want to know about or deal with for example a monetary transaction over a certain amount might be suspicious and warrent a ping to this role. There can only be one role for this.
+### LoggingAlertPingId
+**[ Convar: `discord_logging_ping_id` ]**
+This discord id will be pingged in the event a log is sent with `true` for pingRole. This can be used to give attention to an important log that a dedicated staff team might want to know about or deal with for example a monetary transaction over a certain amount might be suspicious and warrent a ping to this user or role. There can only be one id for this.
+**IMPORTANT NOTE:** If you want to ping a user just put the ID, if you want to **ping a role** put a `&` in front of the role id**
### LoggingWebhooks
This is the array of webhooks you setup to be used with the log system. it uses `"key": "value",` where `key` is the name (case sensitive) of the webhook for you to be able to call from the logging export as the first value
diff --git a/server/bot.js b/server/bot.js
index 8490196..efb6f61 100644
--- a/server/bot.js
+++ b/server/bot.js
@@ -12,7 +12,6 @@
const { Client, Collection, MessageEmbed, MessageActionRow, MessageButton } = require("discord.js");
const { readdirSync } = require("fs");
-
class Bot extends Client {
constructor(z) {
@@ -24,6 +23,7 @@ class Bot extends Client {
this.enabled = z.config.EnableDiscordBot;
this.z = z;
this.config = z.config;
+ this.QBCore = z.QBCore;
this.utils = z.utils;
this.Embed = MessageEmbed;
this.commands = new Collection();
@@ -44,11 +44,6 @@ class Bot extends Client {
this.loadDiscordPermissions();
- try {
- this.QBCore = global.exports["qb-core"].GetCoreObject();
- if (this.QBCore) utils.log.info("QBCore found! Supported QB commands will be loaded.");
- } catch { this.QBCore = false; }
-
if (this.config.EnableDiscordSlashCommands) this.loadCommands();
this.loadEvents();
diff --git a/server/events/messageCreate.js b/server/events/messageCreate.js
index 29bf985..4c1bb1c 100644
--- a/server/events/messageCreate.js
+++ b/server/events/messageCreate.js
@@ -15,8 +15,8 @@ module.exports = {
run: async (client, msg) => {
if (!msg.content || msg.author.bot) return;
if (client.config.EnableStaffChatForwarding && msg.channel.id == client.config.DiscordStaffChannelId) {
- client.utils.sendStaffChatMessage(client, msg.member.displayName, msg.content);
- return console.log(`[STAFF] ${msg.member.displayName}: ${msg.content}`);
+ client.utils.sendStaffChatMessage(client.z, msg.member.displayName, msg.content);
+ return client.z.utils.log.write(`${msg.member.displayName}: ${msg.content}`, { tag: "STAFFCHAT" });
}
},
};
diff --git a/server/queue.js b/server/queue.js
deleted file mode 100644
index da08d68..0000000
--- a/server/queue.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/**
- * This file is part of zdiscord.
- * Copyright (C) 2021 Tony/zfbx
- * source:
- *
- * This work is licensed under the Creative Commons
- * Attribution-NonCommercial-ShareAlike 4.0 International License.
- * To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/4.0/
- * or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
- */
-
-class Queue {
- constructor(z) {
- this.connections = {};
-
- if (z.config.EnableConnectingQueue) {
- StopResource("hardcap");
- StopResource("connectqueue");
- }
- }
-}
-
-
-module.exports = Queue;
diff --git a/server/server.js b/server/server.js
index db6bfae..e75e53d 100644
--- a/server/server.js
+++ b/server/server.js
@@ -11,18 +11,32 @@
const z = {};
+const { readdirSync } = require("fs");
z.root = GetResourcePath(GetCurrentResourceName());
z.config = require(`${z.root}/config`);
z.locale = require(`${z.root}/locales/${z.config.LanguageLocaleCode}`);
z.utils = require(`${z.root}/server/utils`);
-const Bot = require(`${z.root}/server/bot`);
-const Queue = require(`${z.root}/server/queue`);
-const Log = require(`${z.root}/server/log`);
+try {
+ z.QBCore = global.exports["qb-core"].GetCoreObject();
+ if (z.QBCore) z.utils.log.info("QBCore found! Supported QB commands will be loaded.");
+} catch { z.QBCore = false; }
+const Bot = require(`${z.root}/server/bot`);
z.bot = new Bot(z);
-z.queue = new Queue(z);
-z.log = new Log(z);
+
+const addons = readdirSync(`${z.root}/server/addons`).filter(file => file.endsWith(".js"));
+for (const file of addons) {
+ try {
+ const Addon = require(`${z.root}/server/addons/${file}`);
+ z[file.slice(0, -3)] = new Addon(z);
+ z.utils.log.info(`[ADDON] ${file} addon found and loaded`);
+ } catch (e) {
+ z.utils.log.error(`[ADDON] ${file} errored and could not be loaded`);
+ z.utils.log.error(e);
+ }
+}
+
SetConvarReplicated("zdiscord_servername", z.config.FiveMServerName);
SetConvarReplicated("zdiscord_discordinvite", z.config.DiscordInviteLink);
@@ -45,27 +59,15 @@ on("playerConnecting", async (name, setKickReason, deferrals) => {
else deferrals.done(z.utils.replaceGlobals(z, z.locale.notWhitelisted));
});
-global.exports("isRolePresent", (identifier, role) => {
- return z.bot.isRolePresent(identifier, role);
-});
-
-global.exports("getRoles", (identifier) => {
- return z.bot.getMemberRoles(identifier);
-});
-
-global.exports("getName", (identifier) => {
- const member = z.bot.parseMember(identifier);
- return member.displayName || false;
-});
on("playerJoining", (oldId) => {
const source = global.source;
if (!z.config.EnableDiscordBot) return;
const member = z.bot.getMemberFromSource(source);
if (z.config.EnableAutoAcePermissions) {
- for (const [perm, role] of Object.entries(z.config.AutoAcePermissions)) {
+ for (const [group, role] of Object.entries(z.config.AutoAcePermissions)) {
if (z.bot.isRolePresent(member, role)) {
- ExecuteCommand(`add_principal "player.${source}" "${perm}"`);
+ ExecuteCommand(`add_principal "player.${source}" "${group}"`);
}
}
}
@@ -78,14 +80,12 @@ on("playerDropped", (reason) => {
const source = global.source;
if (!z.config.EnableDiscordBot) return false;
if (z.config.EnableAutoAcePermissions) {
- for (const [perm, role] of Object.entries(z.config.AutoAcePermissions)) {
- ExecuteCommand(`remove_principal "player.${source}" "${perm}"`);
+ for (const [group, role] of Object.entries(z.config.AutoAcePermissions)) {
+ ExecuteCommand(`remove_principal "player.${source}" "${group}"`);
}
}
});
-
-
if (z.config.EnableStaffChatForwarding) {
RegisterCommand("staff", (source, args, raw) => {
if (!IsPlayerAceAllowed(source, "zdiscord.staffchat")) return;
@@ -121,7 +121,17 @@ if (z.config.EnableStaffChatForwarding) {
});
}
+// EXPORTS
+
+global.exports("isRolePresent", (identifier, role) => {
+ return z.bot.isRolePresent(identifier, role);
+});
-global.exports("log", async (type, message, pingRole, color) => {
- return z.log.send(type, message, pingRole, color);
+global.exports("getRoles", (identifier) => {
+ return z.bot.getMemberRoles(identifier);
+});
+
+global.exports("getName", (identifier) => {
+ const member = z.bot.parseMember(identifier);
+ return member.displayName || false;
});
diff --git a/server/utils.js b/server/utils.js
index 785b8c5..c09b497 100644
--- a/server/utils.js
+++ b/server/utils.js
@@ -117,6 +117,7 @@ const log = {
* @param {object} settings - Optional overrides of style and label */
error: (content, { color = "\x1b[1;31m", tag = "ERR" } = {}) => {
log.write(content, { color, tag, error: true });
+ return false;
},
/** Write directly to the console with your own tag and style
@@ -125,6 +126,7 @@ const log = {
write: (content, { color = "\x1b[37m", tag = "LOG", error = false } = {}) => {
const stream = error ? process.stderr : process.stdout;
stream.write(`\x1b[1;36m[${GetCurrentResourceName()}]\x1b[0m[${log.timestamp()}]${color}[${tag}]: ${log.clean(content)}\x1b[0m\n`);
+ return false;
},
/** Sanitize content for console logging
@@ -174,15 +176,15 @@ exports.isValidID = isValidID;
/** send staff message to all staff in game with it enabled
- * @param {object} client - Name the message is from
+ * @param {object} z - z
* @param {string} name - Name the message is from
* @param {string} msg - message to send */
-const sendStaffChatMessage = (client, name, msg) => {
+const sendStaffChatMessage = (z, name, msg) => {
if (!msg) return;
getPlayers().forEach(async function(player, index, array) {
if (IsPlayerAceAllowed(player, "zdiscord.staffchat")) {
emitNet("chat:addMessage", player, {
- template: `[${client.z.locale.staffchat}] ${name}: ${msg}
`,
+ template: `[${z.locale.staffchat}] ${name}: ${msg}
`,
});
}
});
From 241e595ea12b30119fc8abaede8d43f058f3ff8f Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Wed, 8 Dec 2021 08:12:42 -0500
Subject: [PATCH 18/21] Synthethics added Slovenian locales
---
docs/index.md | 1 +
1 file changed, 1 insertion(+)
diff --git a/docs/index.md b/docs/index.md
index 1fe8bd2..30016ec 100644
--- a/docs/index.md
+++ b/docs/index.md
@@ -20,6 +20,7 @@ A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and
- ar - Arabic - By RadhwaneDZ
- tr - Turkish - By alp1x
- nl - Dutch - By ChatDisabled
+- sl - Slovenian - By Synthethics
## License
From dfbc707b1fa598dc0c9d50d9ca8e329ea81e1f48 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Wed, 8 Dec 2021 08:13:26 -0500
Subject: [PATCH 19/21] changelog
---
docs/changelog.md | 32 ++++++++++++++++++++++----------
1 file changed, 22 insertions(+), 10 deletions(-)
diff --git a/docs/changelog.md b/docs/changelog.md
index c6bc261..5d64bc6 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -1,22 +1,34 @@
## Change log
-**6.0.0 - Refactor!**
+**7.0.0 - Staff chat, new config AND WEBHOOK LOGGING [2021-12-8]**
+
+- added bi-directional staff chat (messages from discord staff channel <-> fiveM staff chat messages)
+- add discord webhook logging export (think qb-logs)
+- Refactored and added to config to be more clear
+- dutch added. Thanks Chatty <3
+- Slovenian added. Thanks Synthetics <3
+- remove command versioning
+- converted bot into class
+- added addon support
+- relicensed under CC-BY-SA-NC-4.0
+
+**6.0.0 - Refactor! [2021-10-25]**
- command arguments have been refactored to pass as an object instead of an array (This is not backwards compatible which is why it's a version bump)
-**5.0.2 - New commands and docs!**
+**5.0.2 - New commands and docs! [2021-10-23]**
- added screenshot command
- added weather, blackout, time commands
- added docs at [zfbx.github.io/zdiscord](https://zfbx.github.io/zdiscord)
- updated/fixed chat events and teleport command
-**5.0.1 - Exports and ace perms**
+**5.0.1 - Exports and ace perms [2021-10-20]**
- Automatic Ace permission granting by discord role
- new and changed exports for checking if role exist and getting roles
-**5.0.0 - Hello discord.js! & Much much more.**
+**5.0.0 - Hello discord.js! & Much much more. [2021-10-18]**
*It should be noted, this is essentially a complete rewrite of the resource and should probably be treated as such.*
@@ -28,7 +40,7 @@
- added client.js for running events client side
- added linting and editorconfig
-**4.0.0 - permissions! bye yarn!.. and esx.**
+**4.0.0 - permissions! bye yarn!.. and esx. [2021-9-15]**
- Dependencies are now embedded libs making the project slimmer on install and not requiring yarn.
- ESX support was dropped, it wasn't getting used and I don't have an esx server for testing.
@@ -36,7 +48,7 @@
- `add/removepermissions` merged into `perms` command
- Convars changed to be more readable using standard FiveM format with `_` spacing
-**3.2.0 - Convars everywhere!**
+**3.2.0 - Convars everywhere! [2021-7-24]**
- Convar hooks added for nearly every config option [Read More](https://github.com/zfbx/zdiscord/wiki/Convars)
- Slimmed up locales by removing console log messages
@@ -44,13 +56,13 @@
- New Add/Remove permissions command for QBCore
-**3.1.0 - QBCore (potential ESX) support added**
+**3.1.0 - QBCore (potential ESX) support added [2021-7-10]**
- Commands starting with `qb-` will load automatically if QBCore is detected.
- Placeholders for `esx-` commands have been added.
-**3.0.0 - Modular commands!**
+**3.0.0 - Modular commands! [2021-7-10]**
- Commands are now loaded dynamically from the `/commands` folder
- Help command now has sub commands `!help commandName`
@@ -58,12 +70,12 @@
- various Error checks and fixes
-**2.0.0 - Github Release**
+**2.0.0 - Github Release [2021-7-9]**
- polished standalone
- Added translation support
-**1.0.0 - First unsupported build**
+**1.0.0 - First unsupported build [2021-6-10]**
- A lot.
From 6832160a5affcfc35ee14c70b177bd38fd6f7c38 Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Wed, 8 Dec 2021 08:14:03 -0500
Subject: [PATCH 20/21] damnit
---
config.js | 2 --
1 file changed, 2 deletions(-)
diff --git a/config.js b/config.js
index c59d397..6e9c291 100644
--- a/config.js
+++ b/config.js
@@ -69,8 +69,6 @@ const LoggingAlertPingId = "&000000000000000000";
// example: "bank": "https://discord.com/webhook/...",
const LoggingWebhooks = {
"example": "https://discord.com/api/webhooks/000000000/sEcRRet-ToK3n_5tUfF_tH8t_YUo-S40u1d-n07-sHar3",
- "test": "https://discord.com/api/webhooks/912921715854704670/1jJ0UJ2MTdDjqcYPa-UNA2rK_kzGZlcHPyfjyFnyh0BH1paP4TPlj-kGavyGuuPb-8wc",
- "test2": "https://discord.com/api/webhooks/912921913427386420/yW8qoGNDtlxCrCsKK9vJLyVLwMCc0BukcTe7wPSgaBPxSgph_wVnvNjjJ4ew6TZhAPyy",
};
From e8e62bd84a39a9b252977e237933438f6d76f99e Mon Sep 17 00:00:00 2001
From: Tony <1414927+zfbx@users.noreply.github.com>
Date: Wed, 8 Dec 2021 08:37:03 -0500
Subject: [PATCH 21/21] update readme and yarn.lock
---
readme.md | 2 +
yarn.lock | 294 +++++++++++++++++++++++++++---------------------------
2 files changed, 149 insertions(+), 147 deletions(-)
diff --git a/readme.md b/readme.md
index f4f0ee2..c658c14 100644
--- a/readme.md
+++ b/readme.md
@@ -22,6 +22,8 @@ A Discord bot that runs in FiveM for the purpose of whitelisting, moderation and
- Can be configured with [convars](https://zfbx.github.io/zdiscord/convars)
- Automatic Ace Permission granting system
- [Helpful exports](https://zfbx.github.io/zdiscord/exports)
+- bi-directional staff chat
+- AND MORE!
## Setup
diff --git a/yarn.lock b/yarn.lock
index 5d65eb4..ea31860 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -3,90 +3,90 @@
"@discordjs/builders@^0.8.1":
- "integrity" "sha512-/YRd11SrcluqXkKppq/FAVzLIPRVlIVmc6X8ZklspzMIHDtJ+A4W37D43SHvLdH//+NnK+SHW/WeOF4Ts54PeQ=="
- "resolved" "https://registry.npmjs.org/@discordjs/builders/-/builders-0.8.2.tgz"
- "version" "0.8.2"
+ version "0.8.2"
+ resolved "https://registry.yarnpkg.com/@discordjs/builders/-/builders-0.8.2.tgz#c3ef99caa9ebe70a4196b987011d90136c71054a"
+ integrity sha512-/YRd11SrcluqXkKppq/FAVzLIPRVlIVmc6X8ZklspzMIHDtJ+A4W37D43SHvLdH//+NnK+SHW/WeOF4Ts54PeQ==
dependencies:
"@sindresorhus/is" "^4.2.0"
- "discord-api-types" "^0.24.0"
- "ow" "^0.27.0"
- "ts-mixer" "^6.0.0"
- "tslib" "^2.3.1"
+ discord-api-types "^0.24.0"
+ ow "^0.27.0"
+ ts-mixer "^6.0.0"
+ tslib "^2.3.1"
"@discordjs/collection@^0.3.2":
- "integrity" "sha512-dMjLl60b2DMqObbH1MQZKePgWhsNe49XkKBZ0W5Acl5uVV43SN414i2QfZwRI7dXAqIn8pEWD2+XXQFn9KWxqg=="
- "resolved" "https://registry.npmjs.org/@discordjs/collection/-/collection-0.3.2.tgz"
- "version" "0.3.2"
+ version "0.3.2"
+ resolved "https://registry.yarnpkg.com/@discordjs/collection/-/collection-0.3.2.tgz#3c271dd8a93dad89b186d330e24dbceaab58424a"
+ integrity sha512-dMjLl60b2DMqObbH1MQZKePgWhsNe49XkKBZ0W5Acl5uVV43SN414i2QfZwRI7dXAqIn8pEWD2+XXQFn9KWxqg==
"@discordjs/form-data@^3.0.1":
- "integrity" "sha512-ZfFsbgEXW71Rw/6EtBdrP5VxBJy4dthyC0tpQKGKmYFImlmmrykO14Za+BiIVduwjte0jXEBlhSKf0MWbFp9Eg=="
- "resolved" "https://registry.npmjs.org/@discordjs/form-data/-/form-data-3.0.1.tgz"
- "version" "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"
+ asynckit "^0.4.0"
+ combined-stream "^1.0.8"
+ mime-types "^2.1.12"
"@sapphire/async-queue@^1.1.8":
- "integrity" "sha512-CbXaGwwlEMq+l1TRu01FJCvySJ1CEFKFclHT48nIfNeZXaAAmmwwy7scUKmYHPUa3GhoMp6Qr1B3eAJux6XgOQ=="
- "resolved" "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.9.tgz"
- "version" "1.1.9"
+ version "1.1.9"
+ resolved "https://registry.yarnpkg.com/@sapphire/async-queue/-/async-queue-1.1.9.tgz#ce69611c8753c4affd905a7ef43061c7eb95c01b"
+ integrity sha512-CbXaGwwlEMq+l1TRu01FJCvySJ1CEFKFclHT48nIfNeZXaAAmmwwy7scUKmYHPUa3GhoMp6Qr1B3eAJux6XgOQ==
"@sindresorhus/is@^4.0.1", "@sindresorhus/is@^4.2.0":
- "integrity" "sha512-VkE3KLBmJwcCaVARtQpfuKcKv8gcBmUubrfHGF84dXuuW6jgsRYxPtzcIhPyK9WAPpRt2/xY6zkD9MnRaJzSyw=="
- "resolved" "https://registry.npmjs.org/@sindresorhus/is/-/is-4.2.0.tgz"
- "version" "4.2.0"
+ version "4.2.0"
+ resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-4.2.0.tgz#667bfc6186ae7c9e0b45a08960c551437176e1ca"
+ integrity sha512-VkE3KLBmJwcCaVARtQpfuKcKv8gcBmUubrfHGF84dXuuW6jgsRYxPtzcIhPyK9WAPpRt2/xY6zkD9MnRaJzSyw==
"@types/node-fetch@^2.5.12":
- "integrity" "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw=="
- "resolved" "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz"
- "version" "2.5.12"
+ version "2.5.12"
+ resolved "https://registry.yarnpkg.com/@types/node-fetch/-/node-fetch-2.5.12.tgz#8a6f779b1d4e60b7a57fb6fd48d84fb545b9cc66"
+ integrity sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==
dependencies:
"@types/node" "*"
- "form-data" "^3.0.0"
+ form-data "^3.0.0"
"@types/node@*":
- "integrity" "sha512-MKmdASMf3LtPzwLyRrFjtFFZ48cMf8jmX5VRYrDQiJa8Ybu5VAmkqBWqKU8fdCwD8ysw4mQ9nrEHvzg6gunR7A=="
- "resolved" "https://registry.npmjs.org/@types/node/-/node-16.11.9.tgz"
- "version" "16.11.9"
+ version "16.11.12"
+ resolved "https://registry.yarnpkg.com/@types/node/-/node-16.11.12.tgz#ac7fb693ac587ee182c3780c26eb65546a1a3c10"
+ integrity sha512-+2Iggwg7PxoO5Kyhvsq9VarmPbIelXP070HMImEpbtGCoyWNINQj4wzjbQCXzdHTRXnqufutJb5KAURZANNBAw==
"@types/ws@^8.2.0":
- "integrity" "sha512-cyeefcUCgJlEk+hk2h3N+MqKKsPViQgF5boi9TTHSK+PoR9KWBb/C5ccPcDyAqgsbAYHTwulch725DV84+pSpg=="
- "resolved" "https://registry.npmjs.org/@types/ws/-/ws-8.2.0.tgz"
- "version" "8.2.0"
+ version "8.2.2"
+ resolved "https://registry.yarnpkg.com/@types/ws/-/ws-8.2.2.tgz#7c5be4decb19500ae6b3d563043cd407bf366c21"
+ integrity sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==
dependencies:
"@types/node" "*"
-"asynckit@^0.4.0":
- "integrity" "sha1-x57Zf380y48robyXkLzDZkdLS3k="
- "resolved" "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz"
- "version" "0.4.0"
+asynckit@^0.4.0:
+ version "0.4.0"
+ resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79"
+ integrity sha1-x57Zf380y48robyXkLzDZkdLS3k=
-"callsites@^3.1.0":
- "integrity" "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ=="
- "resolved" "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz"
- "version" "3.1.0"
+callsites@^3.1.0:
+ version "3.1.0"
+ resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
+ integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
-"combined-stream@^1.0.8":
- "integrity" "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg=="
- "resolved" "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz"
- "version" "1.0.8"
+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"
-"delayed-stream@~1.0.0":
- "integrity" "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
- "resolved" "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz"
- "version" "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-api-types@^0.24.0":
- "integrity" "sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A=="
- "resolved" "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.24.0.tgz"
- "version" "0.24.0"
+discord-api-types@^0.24.0:
+ version "0.24.0"
+ resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.24.0.tgz#9e429b8a1ddb4147134dfb3109093422de7ec549"
+ integrity sha512-X0uA2a92cRjowUEXpLZIHWl4jiX1NsUpDhcEOpa1/hpO1vkaokgZ8kkPtPih9hHth5UVQ3mHBu/PpB4qjyfJ4A==
"discord.js@github:zfbx/discord.js":
- "resolved" "git+ssh://git@github.com/zfbx/discord.js.git#2c56b697c5515024600e59e09c42702170404ead"
- "version" "13.4.0-dev"
+ version "13.4.0-dev"
+ resolved "https://codeload.github.com/zfbx/discord.js/tar.gz/2c56b697c5515024600e59e09c42702170404ead"
dependencies:
"@discordjs/builders" "^0.8.1"
"@discordjs/collection" "^0.3.2"
@@ -94,106 +94,106 @@
"@sapphire/async-queue" "^1.1.8"
"@types/node-fetch" "^2.5.12"
"@types/ws" "^8.2.0"
- "discord-api-types" "^0.24.0"
- "node-fetch" "^2.6.1"
- "ws" "^8.2.3"
-
-"dot-prop@^6.0.1":
- "integrity" "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA=="
- "resolved" "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz"
- "version" "6.0.1"
+ discord-api-types "^0.24.0"
+ node-fetch "^2.6.1"
+ ws "^8.2.3"
+
+dot-prop@^6.0.1:
+ version "6.0.1"
+ resolved "https://registry.yarnpkg.com/dot-prop/-/dot-prop-6.0.1.tgz#fc26b3cf142b9e59b74dbd39ed66ce620c681083"
+ integrity sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==
dependencies:
- "is-obj" "^2.0.0"
+ is-obj "^2.0.0"
-"form-data@^3.0.0":
- "integrity" "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg=="
- "resolved" "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz"
- "version" "3.0.1"
+form-data@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/form-data/-/form-data-3.0.1.tgz#ebd53791b78356a99af9a300d4282c4d5eb9755f"
+ integrity sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==
dependencies:
- "asynckit" "^0.4.0"
- "combined-stream" "^1.0.8"
- "mime-types" "^2.1.12"
-
-"is-obj@^2.0.0":
- "integrity" "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w=="
- "resolved" "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz"
- "version" "2.0.0"
-
-"lodash.isequal@^4.5.0":
- "integrity" "sha1-QVxEePK8wwEgwizhDtMib30+GOA="
- "resolved" "https://registry.npmjs.org/lodash.isequal/-/lodash.isequal-4.5.0.tgz"
- "version" "4.5.0"
-
-"mime-db@1.51.0":
- "integrity" "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g=="
- "resolved" "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz"
- "version" "1.51.0"
-
-"mime-types@^2.1.12":
- "integrity" "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A=="
- "resolved" "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz"
- "version" "2.1.34"
+ asynckit "^0.4.0"
+ combined-stream "^1.0.8"
+ mime-types "^2.1.12"
+
+is-obj@^2.0.0:
+ version "2.0.0"
+ resolved "https://registry.yarnpkg.com/is-obj/-/is-obj-2.0.0.tgz#473fb05d973705e3fd9620545018ca8e22ef4982"
+ integrity sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==
+
+lodash.isequal@^4.5.0:
+ version "4.5.0"
+ resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0"
+ integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA=
+
+mime-db@1.51.0:
+ version "1.51.0"
+ resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.51.0.tgz#d9ff62451859b18342d960850dc3cfb77e63fb0c"
+ integrity sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==
+
+mime-types@^2.1.12:
+ version "2.1.34"
+ resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.34.tgz#5a712f9ec1503511a945803640fafe09d3793c24"
+ integrity sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==
dependencies:
- "mime-db" "1.51.0"
+ mime-db "1.51.0"
-"node-fetch@^2.6.1", "node-fetch@^2.6.6":
- "integrity" "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA=="
- "resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz"
- "version" "2.6.6"
+node-fetch@^2.6.1, node-fetch@^2.6.6:
+ version "2.6.6"
+ resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.6.tgz#1751a7c01834e8e1697758732e9efb6eeadfaf89"
+ integrity sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA==
dependencies:
- "whatwg-url" "^5.0.0"
+ whatwg-url "^5.0.0"
-"ow@^0.27.0":
- "integrity" "sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ=="
- "resolved" "https://registry.npmjs.org/ow/-/ow-0.27.0.tgz"
- "version" "0.27.0"
+ow@^0.27.0:
+ version "0.27.0"
+ resolved "https://registry.yarnpkg.com/ow/-/ow-0.27.0.tgz#d44da088e8184fa11de64b5813206f9f86ab68d0"
+ integrity sha512-SGnrGUbhn4VaUGdU0EJLMwZWSupPmF46hnTRII7aCLCrqixTAC5eKo8kI4/XXf1eaaI8YEVT+3FeGNJI9himAQ==
dependencies:
"@sindresorhus/is" "^4.0.1"
- "callsites" "^3.1.0"
- "dot-prop" "^6.0.1"
- "lodash.isequal" "^4.5.0"
- "type-fest" "^1.2.1"
- "vali-date" "^1.0.0"
-
-"tr46@~0.0.3":
- "integrity" "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
- "resolved" "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz"
- "version" "0.0.3"
-
-"ts-mixer@^6.0.0":
- "integrity" "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
- "resolved" "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz"
- "version" "6.0.0"
-
-"tslib@^2.3.1":
- "integrity" "sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw=="
- "resolved" "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz"
- "version" "2.3.1"
-
-"type-fest@^1.2.1":
- "integrity" "sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA=="
- "resolved" "https://registry.npmjs.org/type-fest/-/type-fest-1.4.0.tgz"
- "version" "1.4.0"
-
-"vali-date@^1.0.0":
- "integrity" "sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY="
- "resolved" "https://registry.npmjs.org/vali-date/-/vali-date-1.0.0.tgz"
- "version" "1.0.0"
-
-"webidl-conversions@^3.0.0":
- "integrity" "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
- "resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
- "version" "3.0.1"
-
-"whatwg-url@^5.0.0":
- "integrity" "sha1-lmRU6HZUYuN2RNNib2dCzotwll0="
- "resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz"
- "version" "5.0.0"
+ callsites "^3.1.0"
+ dot-prop "^6.0.1"
+ lodash.isequal "^4.5.0"
+ type-fest "^1.2.1"
+ vali-date "^1.0.0"
+
+tr46@~0.0.3:
+ version "0.0.3"
+ resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
+ integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=
+
+ts-mixer@^6.0.0:
+ version "6.0.0"
+ resolved "https://registry.yarnpkg.com/ts-mixer/-/ts-mixer-6.0.0.tgz#4e631d3a36e3fa9521b973b132e8353bc7267f9f"
+ integrity sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ==
+
+tslib@^2.3.1:
+ version "2.3.1"
+ resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01"
+ integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw==
+
+type-fest@^1.2.1:
+ version "1.4.0"
+ resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-1.4.0.tgz#e9fb813fe3bf1744ec359d55d1affefa76f14be1"
+ integrity sha512-yGSza74xk0UG8k+pLh5oeoYirvIiWo5t0/o3zHHAO2tRDiZcxWP7fywNlXhqb6/r6sWvwi+RsyQMWhVLe4BVuA==
+
+vali-date@^1.0.0:
+ version "1.0.0"
+ resolved "https://registry.yarnpkg.com/vali-date/-/vali-date-1.0.0.tgz#1b904a59609fb328ef078138420934f6b86709a6"
+ integrity sha1-G5BKWWCfsyjvB4E4Qgk09rhnCaY=
+
+webidl-conversions@^3.0.0:
+ version "3.0.1"
+ resolved "https://registry.yarnpkg.com/webidl-conversions/-/webidl-conversions-3.0.1.tgz#24534275e2a7bc6be7bc86611cc16ae0a5654871"
+ integrity sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=
+
+whatwg-url@^5.0.0:
+ version "5.0.0"
+ resolved "https://registry.yarnpkg.com/whatwg-url/-/whatwg-url-5.0.0.tgz#966454e8765462e37644d3626f6742ce8b70965d"
+ integrity sha1-lmRU6HZUYuN2RNNib2dCzotwll0=
dependencies:
- "tr46" "~0.0.3"
- "webidl-conversions" "^3.0.0"
+ tr46 "~0.0.3"
+ webidl-conversions "^3.0.0"
-"ws@^8.2.3":
- "integrity" "sha512-wBuoj1BDpC6ZQ1B7DWQBYVLphPWkm8i9Y0/3YdHjHKHiohOJ1ws+3OccDWtH+PoC9DZD5WOTrJvNbWvjS6JWaA=="
- "resolved" "https://registry.npmjs.org/ws/-/ws-8.2.3.tgz"
- "version" "8.2.3"
+ws@^8.2.3:
+ version "8.3.0"
+ resolved "https://registry.yarnpkg.com/ws/-/ws-8.3.0.tgz#7185e252c8973a60d57170175ff55fdbd116070d"
+ integrity sha512-Gs5EZtpqZzLvmIM59w4igITU57lrtYVFneaa434VROv4thzJyV6UjIL3D42lslWlI+D4KzLYnxSwtfuiO79sNw==