From 37b0fc71ece85c332321f804a727d89364bc807c Mon Sep 17 00:00:00 2001 From: ultimateplayer1999 Date: Wed, 26 Apr 2023 09:32:56 +0000 Subject: [PATCH] Added spacing and presence --- client.js | 18 +++++++++++++++--- dbinit.js | 2 +- models/wolfcount.js | 4 ++-- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client.js b/client.js index 6476b15..29fd9c2 100644 --- a/client.js +++ b/client.js @@ -1,5 +1,5 @@ require('dotenv').config(); -const {Client} = require('discord.js'); +const {Client, ActivityType} = require('discord.js'); const mongoose = require('mongoose'); const Wolfcount = require('./models/wolfcount'); @@ -21,11 +21,16 @@ const client = new Client({ intents: 34305 }); client.on("ready", () => { // set the status to do not disturb - client.user.setStatus('dnd') + // client.user.setStatus('dnd') + client.user.setPresence({ + activities: [{ name: `over msgs for certain letters`, type: ActivityType.Watching }], + status: 'dnd', + }); }); // Error handling client.on("error", (error) => { + console.log(''); console.error("Something went wrong:", error); }); @@ -34,6 +39,7 @@ const wolfChars = ['w', 'o', 'l', 'f']; // Find a document by validation Wolfcount.findOne({ validation: 'wolfcount' }).then((countdocument) => { + console.log(''); console.log(countdocument); }).catch((error) => { console.error(error); @@ -43,6 +49,7 @@ basecount = 0 // Reset the wolf count Wolfcount.findByIdAndUpdate("6447da87681fd1bc486a4923", {count: basecount}).then(() => { + console.log(''); console.log('Count reset!'); }).catch((error) => { console.error(error); @@ -58,9 +65,14 @@ client.on("messageCreate", (message) => { message.react("🐺").catch(err=>console.log(err)); newcount = basecount + 1; + client.user.setPresence({ + activities: [{ name: `${newcount} message(s) detected`, type: ActivityType.Watching }], + status: 'dnd', + }); basecount = newcount; - console.log('Live wolf count', newcount); + console.log(''); + console.log('Live wolf count:', newcount); // update the wolf count Wolfcount.findByIdAndUpdate("6447da87681fd1bc486a4923", {count: newcount}).then(() => { diff --git a/dbinit.js b/dbinit.js index b31866d..8e42984 100644 --- a/dbinit.js +++ b/dbinit.js @@ -23,7 +23,7 @@ try { // ensure that the bot stats document exists const wolfcount = new Wolfcount({ count: 0, - validation: "count" + validation: "wolfcount" }); wolfcount.save().then(() => { diff --git a/models/wolfcount.js b/models/wolfcount.js index aba2f16..ac61bed 100644 --- a/models/wolfcount.js +++ b/models/wolfcount.js @@ -1,10 +1,10 @@ const mongoose = require('mongoose'); -const wolfclountSchema = new mongoose.Schema({ +const wolfcountSchema = new mongoose.Schema({ count: Number, validation: String }); -const Wolfcount = mongoose.model('Wolfcount', wolfclountSchema); +const Wolfcount = mongoose.model('Wolfcount', wolfcountSchema); module.exports = Wolfcount; \ No newline at end of file