mirror of
https://github.com/Hessenuk/DiscordTickets.git
synced 2024-12-23 08:13:09 +02:00
Make things work
This commit is contained in:
parent
5fdfb121c7
commit
4c8e9125e5
@ -29,6 +29,7 @@
|
|||||||
"funding": "https://github.com/eartharoid/DiscordTickets/?sponsor=1",
|
"funding": "https://github.com/eartharoid/DiscordTickets/?sponsor=1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@eartharoid/i18n": "^0.0.1",
|
"@eartharoid/i18n": "^0.0.1",
|
||||||
|
"command-exists": "^1.2.9",
|
||||||
"discord.js": "^12.5.1",
|
"discord.js": "^12.5.1",
|
||||||
"dotenv": "^8.2.0",
|
"dotenv": "^8.2.0",
|
||||||
"keyv": "^4.0.3",
|
"keyv": "^4.0.3",
|
||||||
@ -36,8 +37,7 @@
|
|||||||
"leekslazylogger": "^2.0.7",
|
"leekslazylogger": "^2.0.7",
|
||||||
"node-fetch": "^2.6.1",
|
"node-fetch": "^2.6.1",
|
||||||
"sequelize": "^6.5.0",
|
"sequelize": "^6.5.0",
|
||||||
"terminal-link": "^2.1.1",
|
"terminal-link": "^2.1.1"
|
||||||
"yarpm": "^1.1.1"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.20.0",
|
"eslint": "^7.20.0",
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@eartharoid/i18n': 0.0.1
|
'@eartharoid/i18n': 0.0.1
|
||||||
|
command-exists: 1.2.9
|
||||||
discord.js: 12.5.1
|
discord.js: 12.5.1
|
||||||
dotenv: 8.2.0
|
dotenv: 8.2.0
|
||||||
keyv: 4.0.3
|
keyv: 4.0.3
|
||||||
@ -8,7 +9,6 @@ dependencies:
|
|||||||
node-fetch: 2.6.1
|
node-fetch: 2.6.1
|
||||||
sequelize: 6.5.0_fb66e8c649bde1be622cc06164c9e22d
|
sequelize: 6.5.0_fb66e8c649bde1be622cc06164c9e22d
|
||||||
terminal-link: 2.1.1
|
terminal-link: 2.1.1
|
||||||
yarpm: 1.1.1
|
|
||||||
devDependencies:
|
devDependencies:
|
||||||
eslint: 7.20.0
|
eslint: 7.20.0
|
||||||
mariadb: 2.5.2
|
mariadb: 2.5.2
|
||||||
@ -611,6 +611,7 @@ packages:
|
|||||||
path-key: 3.1.1
|
path-key: 3.1.1
|
||||||
shebang-command: 2.0.0
|
shebang-command: 2.0.0
|
||||||
which: 2.0.2
|
which: 2.0.2
|
||||||
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
node: '>= 8'
|
node: '>= 8'
|
||||||
resolution:
|
resolution:
|
||||||
@ -1902,6 +1903,7 @@ packages:
|
|||||||
resolution:
|
resolution:
|
||||||
integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
|
integrity: sha1-F0uSaHNVNP+8es5r9TpanhtcX18=
|
||||||
/path-key/3.1.1:
|
/path-key/3.1.1:
|
||||||
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
node: '>=8'
|
node: '>=8'
|
||||||
resolution:
|
resolution:
|
||||||
@ -2336,11 +2338,13 @@ packages:
|
|||||||
/shebang-command/2.0.0:
|
/shebang-command/2.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
shebang-regex: 3.0.0
|
shebang-regex: 3.0.0
|
||||||
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
node: '>=8'
|
node: '>=8'
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
|
integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==
|
||||||
/shebang-regex/3.0.0:
|
/shebang-regex/3.0.0:
|
||||||
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
node: '>=8'
|
node: '>=8'
|
||||||
resolution:
|
resolution:
|
||||||
@ -2773,6 +2777,7 @@ packages:
|
|||||||
/which/2.0.2:
|
/which/2.0.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
isexe: 2.0.0
|
isexe: 2.0.0
|
||||||
|
dev: true
|
||||||
engines:
|
engines:
|
||||||
node: '>= 8'
|
node: '>= 8'
|
||||||
hasBin: true
|
hasBin: true
|
||||||
@ -2882,16 +2887,9 @@ packages:
|
|||||||
/yallist/4.0.0:
|
/yallist/4.0.0:
|
||||||
resolution:
|
resolution:
|
||||||
integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==
|
||||||
/yarpm/1.1.1:
|
|
||||||
dependencies:
|
|
||||||
command-exists: 1.2.9
|
|
||||||
cross-spawn: 7.0.3
|
|
||||||
dev: false
|
|
||||||
hasBin: true
|
|
||||||
resolution:
|
|
||||||
integrity: sha512-A3gVdtyld+gYcVmKScvJqS2oT/i9xdsb/SqDsY9c0+BeYdYBUJrRfr4pD7UP+5uXEneJ0BL0rC/6rd1fnlYEcg==
|
|
||||||
specifiers:
|
specifiers:
|
||||||
'@eartharoid/i18n': ^0.0.1
|
'@eartharoid/i18n': ^0.0.1
|
||||||
|
command-exists: ^1.2.9
|
||||||
discord.js: ^12.5.1
|
discord.js: ^12.5.1
|
||||||
dotenv: ^8.2.0
|
dotenv: ^8.2.0
|
||||||
eslint: ^7.20.0
|
eslint: ^7.20.0
|
||||||
@ -2908,4 +2906,3 @@ specifiers:
|
|||||||
sqlite3: ^5.0.2
|
sqlite3: ^5.0.2
|
||||||
tedious: ^11.0.3
|
tedious: ^11.0.3
|
||||||
terminal-link: ^2.1.1
|
terminal-link: ^2.1.1
|
||||||
yarpm: ^1.1.1
|
|
||||||
|
18
src/index.js
18
src/index.js
@ -60,21 +60,6 @@ const log = new Logger({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
log.report = error => {
|
|
||||||
let report = [
|
|
||||||
'<< Issue report >>',
|
|
||||||
'Please include this information if you ask for help about the following error!',
|
|
||||||
`Support server: ${terminalLink('go.eartharoid.me/discord', 'https://go.eartharoid.me/discord')}`,
|
|
||||||
`Node.JS version: ${process.versions.node}`,
|
|
||||||
`Bot version: ${version}`,
|
|
||||||
`Platform: ${process.platform}`
|
|
||||||
];
|
|
||||||
log.warn(report.join('\n'));
|
|
||||||
if (error) log.error(error);
|
|
||||||
};
|
|
||||||
|
|
||||||
const terminalLink = require('terminal-link');
|
|
||||||
const I18n = require('@eartharoid/i18n');
|
const I18n = require('@eartharoid/i18n');
|
||||||
const { CommandManager } = require('./modules/commands');
|
const { CommandManager } = require('./modules/commands');
|
||||||
|
|
||||||
@ -119,7 +104,8 @@ class Bot extends Client {
|
|||||||
new Bot();
|
new Bot();
|
||||||
|
|
||||||
process.on('unhandledRejection', error => {
|
process.on('unhandledRejection', error => {
|
||||||
log.report();
|
log.notice('PLEASE INCLUDE THIS INFORMATION:');
|
||||||
|
log.warn(`Discord Tickets v${version}, Node ${process.versions.node} (${process.platform})`);
|
||||||
log.warn('An error was not caught');
|
log.warn('An error was not caught');
|
||||||
if (error instanceof Error) log.warn(`Uncaught ${error.name}: ${error}`);
|
if (error instanceof Error) log.warn(`Uncaught ${error.name}: ${error}`);
|
||||||
log.error(error);
|
log.error(error);
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
event: 'messageReactionAdd',
|
event: 'messageReactionAdd',
|
||||||
execute: (client, r, u) => {
|
execute: (client, r, u) => {
|
||||||
client.log.info('messageReactionAdd');
|
|
||||||
console.log(r);
|
|
||||||
console.log(u);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,6 +1,6 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
event: 'ready',
|
event: 'ready',
|
||||||
execute: client => {
|
execute: (client) => {
|
||||||
client.log.success(`Connected to Discord as ${client.user.tag}`);
|
client.log.success(`Connected to Discord as "${client.user.tag}"`);
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -7,7 +7,6 @@ module.exports = client => {
|
|||||||
|
|
||||||
for (const file of files) {
|
for (const file of files) {
|
||||||
const listener = require(`../listeners/${file}`);
|
const listener = require(`../listeners/${file}`);
|
||||||
// client.on(listener.event, ...args => listener.execute(client, ...args));
|
client.on(listener.event, (...args) => listener.execute(client, ...args));
|
||||||
client.on(listener.event, args => listener.execute(client, args));
|
|
||||||
}
|
}
|
||||||
};
|
};
|
@ -1,35 +1,14 @@
|
|||||||
const yarpm = require('yarpm');
|
|
||||||
const fs = require('fs');
|
|
||||||
const { join } = require('path');
|
|
||||||
const { path } = require('../utils/fs');
|
|
||||||
|
|
||||||
module.exports = async client => {
|
module.exports = async client => {
|
||||||
const plugins = {};
|
client.config.plugins.forEach(plugin => {
|
||||||
const dirs = fs.readdirSync(path('./user/plugins'));
|
try {
|
||||||
|
let package = require(`${plugin}/package.json`);
|
||||||
for (const dir of dirs) {
|
client.log.plugins(`Loading ${package.name} v${package.version} by ${package.author?.name || 'unknown'}`);
|
||||||
let package_path = path(`./user/plugins/${dir}/package.json`);
|
require(plugin)(client);
|
||||||
if (!fs.existsSync(package_path)) continue;
|
} catch (e) {
|
||||||
|
client.log.warn(`An error occurred whilst loading ${plugin}, have you installed it?`);
|
||||||
let package = require(`../../user/plugins/${dir}/package.json`);
|
client.log.error(e);
|
||||||
let main = require(join(`../../user/plugins/${dir}/`, package.main));
|
return process.exit();
|
||||||
|
|
||||||
plugins[package.name] = package;
|
|
||||||
client.log.plugins(`Loading ${package.name} v${package.version} by ${package.author}`);
|
|
||||||
|
|
||||||
if (package.dependencies && Object.keys(package.dependencies).length >= 1) {
|
|
||||||
client.log.plugins(`Installing dependencies for ${package.name}`);
|
|
||||||
let deps = Object.keys(package.dependencies)
|
|
||||||
.map(d => `${d}@${package.dependencies[d]}`)
|
|
||||||
.join(' ');
|
|
||||||
|
|
||||||
await yarpm(['install', '--no-save', deps], {
|
|
||||||
stdout: process.stdout
|
|
||||||
});
|
|
||||||
await main(client);
|
|
||||||
} else {
|
|
||||||
await main(client);
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
@ -23,6 +23,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
debug: false,
|
||||||
|
defaults: {
|
||||||
|
colour: '#009999',
|
||||||
|
locale: 'en-GB'
|
||||||
|
},
|
||||||
|
logs: {
|
||||||
|
enabled: true,
|
||||||
|
keep_for: 30
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
// 'dsctickets.plugin-name'
|
||||||
|
'discordtickets-portal'
|
||||||
|
],
|
||||||
portal: {
|
portal: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
host: 'https://tickets.example.com'
|
host: 'https://tickets.example.com'
|
||||||
@ -41,14 +54,5 @@ module.exports = {
|
|||||||
type: 'WATCHING'
|
type: 'WATCHING'
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
defaults: {
|
|
||||||
colour: '#009999',
|
|
||||||
locale: 'en-GB'
|
|
||||||
},
|
|
||||||
logs: {
|
|
||||||
enabled: true,
|
|
||||||
keep_for: 30
|
|
||||||
},
|
|
||||||
debug: false,
|
|
||||||
update_notice: true,
|
update_notice: true,
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user