Logger & presence activities

This commit is contained in:
Isaac (eartharoid) 2020-10-12 22:45:37 +01:00
parent 93d332f898
commit 5846b88db2
21 changed files with 60 additions and 44 deletions

3
.gitignore vendored
View File

@ -5,4 +5,5 @@ user/dev.config.js
user/storage.db user/storage.db
user/transcripts/text/*.txt user/transcripts/text/*.txt
user/transcripts/raw/*.log user/transcripts/raw/*.log
user/transcripts/raw/entities/*.json user/transcripts/raw/entities/*.json
*.code-workspace

2
package-lock.json generated
View File

@ -1,6 +1,6 @@
{ {
"name": "@eartharoid/discordtickets", "name": "@eartharoid/discordtickets",
"version": "2.0.1", "version": "2.0.2",
"lockfileVersion": 1, "lockfileVersion": 1,
"requires": true, "requires": true,
"dependencies": { "dependencies": {

View File

@ -7,8 +7,8 @@
*/ */
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
module.exports = { module.exports = {
name: 'add', name: 'add',

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const { const {
MessageEmbed MessageEmbed
} = require('discord.js'); } = require('discord.js');

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const { const {
MessageEmbed MessageEmbed
} = require('discord.js'); } = require('discord.js');

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
module.exports = { module.exports = {

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const fs = require('fs'); const fs = require('fs');

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
module.exports = { module.exports = {

View File

@ -7,8 +7,8 @@
*/ */
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
module.exports = { module.exports = {
name: 'remove', name: 'remove',

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
module.exports = { module.exports = {
event: 'debug', event: 'debug',

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
module.exports = { module.exports = {
event: 'error', event: 'error',

View File

@ -7,8 +7,8 @@
*/ */
const { Collection, MessageEmbed } = require('discord.js'); const { Collection, MessageEmbed } = require('discord.js');
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const archive = require('../modules/archive'); const archive = require('../modules/archive');
module.exports = { module.exports = {

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const fs = require('fs'); const fs = require('fs');
module.exports = { module.exports = {

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const { MessageEmbed } = require('discord.js'); const { MessageEmbed } = require('discord.js');
const fs = require('fs'); const fs = require('fs');

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const fs = require('fs'); const fs = require('fs');
module.exports = { module.exports = {

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
module.exports = { module.exports = {
event: 'rateLimit', event: 'rateLimit',

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const config = require('../../user/' + require('../').config); const config = require('../../user/' + require('../').config);
module.exports = { module.exports = {
@ -16,14 +16,16 @@ module.exports = {
log.success(`Authenticated as ${client.user.tag}`); log.success(`Authenticated as ${client.user.tag}`);
const updatePresence = () => { const updatePresence = () => {
let num = Math.floor(Math.random() * config.activities.length); const presence = config.presences[Math.floor(Math.random() * config.presences.length)];
let activity = presence.activity + config.append_presence;
activity = activity.replace(/%s/g, config.prefix);
client.user.setPresence({ client.user.setPresence({
activity: { activity: {
name: config.activities[num] + ` | ${config.prefix}help`, name: activity,
type: config.activity_types[num] type: presence.type.toUpperCase()
} }
}).catch(log.error); }).catch(log.error);
log.debug(`Updated presence: ${config.activity_types[num]} ${config.activities[num]}`); log.debug(`Updated presence: ${activity} ${presence.type}`);
}; };
updatePresence(); updatePresence();

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
module.exports = { module.exports = {
event: 'warn', event: 'warn',

View File

@ -7,8 +7,8 @@
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const lineReader = require('line-reader'); const lineReader = require('line-reader');
const fs = require('fs'); const fs = require('fs');
const dtf = require('@eartharoid/dtf'); const dtf = require('@eartharoid/dtf');

View File

@ -6,8 +6,8 @@
* *
*/ */
const ChildLogger = require('leekslazylogger').ChildLogger; const Logger = require('leekslazylogger');
const log = new ChildLogger(); const log = new Logger();
const fetch = require('node-fetch'); const fetch = require('node-fetch');
const config = require('../../user/' + require('../').config); const config = require('../../user/' + require('../').config);
let {version} = require('../../package.json'); let {version} = require('../../package.json');

View File

@ -29,8 +29,21 @@
module.exports = { module.exports = {
prefix: '-', prefix: '-',
name: 'DiscordTickets', name: 'DiscordTickets',
activities: ['-new', 'with tickets', 'for new tickets'], presences: [
activity_types: ['PLAYING', 'PLAYING', 'WATCHING'], // Available: PLAYING / LISTENING / WATCHING / STREAMING {
activity: '%snew',
type: 'PLAYING'
},
{
activity: 'with tickets',
type: 'PLAYING'
},
{
activity: 'for new tickets',
type: 'WATCHING'
}
],
append_presence: ' | %shelp',
colour: '#009999', colour: '#009999',
err_colour: 'RED', err_colour: 'RED',
cooldown: 3, cooldown: 3,