v0.0.2
This commit is contained in:
commit
b0d64c3656
8 changed files with 195 additions and 6 deletions
4
.env.example
Normal file
4
.env.example
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
DISCORD_TOKEN=""
|
||||||
|
|
||||||
|
BAN_LOG_CHANNEL=""
|
||||||
|
DONT_TYPE_HERE_CHANNEL=""
|
||||||
1
.nvmrc
Normal file
1
.nvmrc
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
v24.14.0
|
||||||
90
package-lock.json
generated
90
package-lock.json
generated
|
|
@ -1,15 +1,17 @@
|
||||||
{
|
{
|
||||||
"name": "lucy_watchcat",
|
"name": "lucy_watchcat",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "lucy_watchcat",
|
"name": "lucy_watchcat",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^14.26.3"
|
"chalk": "^4.1.2",
|
||||||
|
"discord.js": "^14.26.3",
|
||||||
|
"dotenv": "^17.4.2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@discordjs/builders": {
|
"node_modules/@discordjs/builders": {
|
||||||
|
|
@ -213,6 +215,55 @@
|
||||||
"npm": ">=7.0.0"
|
"npm": ">=7.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/ansi-styles": {
|
||||||
|
"version": "4.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
|
||||||
|
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"color-convert": "^2.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/chalk": {
|
||||||
|
"version": "4.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
|
||||||
|
"integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ansi-styles": "^4.1.0",
|
||||||
|
"supports-color": "^7.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/chalk/chalk?sponsor=1"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-convert": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"color-name": "~1.1.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=7.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/color-name": {
|
||||||
|
"version": "1.1.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
|
||||||
|
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/discord-api-types": {
|
"node_modules/discord-api-types": {
|
||||||
"version": "0.38.47",
|
"version": "0.38.47",
|
||||||
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.47.tgz",
|
"resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.38.47.tgz",
|
||||||
|
|
@ -249,12 +300,33 @@
|
||||||
"url": "https://github.com/discordjs/discord.js?sponsor"
|
"url": "https://github.com/discordjs/discord.js?sponsor"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/dotenv": {
|
||||||
|
"version": "17.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
|
||||||
|
"integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==",
|
||||||
|
"license": "BSD-2-Clause",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=12"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://dotenvx.com"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/fast-deep-equal": {
|
"node_modules/fast-deep-equal": {
|
||||||
"version": "3.1.3",
|
"version": "3.1.3",
|
||||||
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
|
||||||
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
"integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/has-flag": {
|
||||||
|
"version": "4.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
|
||||||
|
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/lodash": {
|
"node_modules/lodash": {
|
||||||
"version": "4.18.1",
|
"version": "4.18.1",
|
||||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
|
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.18.1.tgz",
|
||||||
|
|
@ -273,6 +345,18 @@
|
||||||
"integrity": "sha512-afO2mnxW7GDTXMm5/AoN1WuOcdoKhtgXjIvHmobqTD1grNplhGdv3PFOyjCVmrnOZBIT/gD/koDKpYG+0mvHcg==",
|
"integrity": "sha512-afO2mnxW7GDTXMm5/AoN1WuOcdoKhtgXjIvHmobqTD1grNplhGdv3PFOyjCVmrnOZBIT/gD/koDKpYG+0mvHcg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
|
"node_modules/supports-color": {
|
||||||
|
"version": "7.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
|
||||||
|
"integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"has-flag": "^4.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/ts-mixer": {
|
"node_modules/ts-mixer": {
|
||||||
"version": "6.0.4",
|
"version": "6.0.4",
|
||||||
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz",
|
"resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.4.tgz",
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,17 @@
|
||||||
{
|
{
|
||||||
"name": "lucy_watchcat",
|
"name": "lucy_watchcat",
|
||||||
"version": "0.0.1",
|
"version": "0.0.2",
|
||||||
"description": "",
|
"description": "",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"author": "",
|
"author": "",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"main": "watchcat.js",
|
"main": "src/watchcat.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nodemon . --watch"
|
"dev": "nodemon . --watch"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"discord.js": "^14.26.3"
|
"chalk": "^4.1.2",
|
||||||
|
"discord.js": "^14.26.3",
|
||||||
|
"dotenv": "^17.4.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
src/events.js
Normal file
34
src/events.js
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
const chalk = require('chalk');
|
||||||
|
|
||||||
|
function loadEvents(client) {
|
||||||
|
const folders = fs.readdirSync(`${__dirname}/events`);
|
||||||
|
|
||||||
|
console.log(`${chalk.blue.bold('[MRVN]')} Loading event handler...`);
|
||||||
|
|
||||||
|
for (const folder of folders) {
|
||||||
|
const files = fs.readdirSync(`${__dirname}/events/${folder}`).filter(file => file.endsWith('.js'));
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
const event = require(`./events/${folder}/${file}`);
|
||||||
|
|
||||||
|
if (event.rest) {
|
||||||
|
if (event.once) {
|
||||||
|
client.rest.once(event.name, (...args) => event.execute(...args, client));
|
||||||
|
} else {
|
||||||
|
client.rest.on(event.name, (...args) => event.execute(...args, client));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (event.once) {
|
||||||
|
client.once(event.name, (...args) => event.execute(...args, client));
|
||||||
|
} else {
|
||||||
|
client.on(event.name, (...args) => event.execute(...args, client));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`${chalk.blue.bold('[MRVN]')} ${event.name} event loaded`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = { loadEvents };
|
||||||
23
src/events/client/messageCreate.js
Normal file
23
src/events/client/messageCreate.js
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
const chalk = require('chalk');
|
||||||
|
const { Collection, ActivityType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'messageCreate',
|
||||||
|
once: false,
|
||||||
|
async execute(message, client) {
|
||||||
|
const channelID = message.channelId;
|
||||||
|
const banChannelID = process.env.DONT_TYPE_HERE_CHANNEL;
|
||||||
|
const banLogChannel = await client.channels.fetch(process.env.BAN_LOG_CHANNEL);
|
||||||
|
|
||||||
|
// Ignore if staff
|
||||||
|
if (message.member.roles.cache.some(role => role.name === 'Staff')) return;
|
||||||
|
|
||||||
|
// Ignore if not in the "dont-type-here" channel
|
||||||
|
if (channelID !== banChannelID) return;
|
||||||
|
|
||||||
|
// Ban user if they type in the channel
|
||||||
|
await message.member.ban({ reason: `Likely bot, typed in <#${process.env.DONT_TYPE_HERE_CHANNEL}>`, deleteMessageSeconds: 60 * 60 * 24 });
|
||||||
|
await banLogChannel.send(`User <@${message.author.id}> has been banned for typing in <#${process.env.DONT_TYPE_HERE_CHANNEL}>.`);
|
||||||
|
},
|
||||||
|
};
|
||||||
18
src/events/client/ready.js
Normal file
18
src/events/client/ready.js
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
const fs = require('fs');
|
||||||
|
const chalk = require('chalk');
|
||||||
|
const { Collection, ActivityType } = require('discord.js');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
name: 'clientReady',
|
||||||
|
once: true,
|
||||||
|
async execute(client) {
|
||||||
|
console.log(`${chalk.green.bold('[WatchCat]')} Discord gateway connection established. Logged in as ${client.user.username}`);
|
||||||
|
|
||||||
|
function updatePresence() {
|
||||||
|
client.user.setActivity(`MEWOW (ban noises)`, { type: ActivityType.Custom });
|
||||||
|
}
|
||||||
|
|
||||||
|
updatePresence();
|
||||||
|
setInterval(updatePresence, 1000 * 60 * 60 * 12);
|
||||||
|
},
|
||||||
|
};
|
||||||
23
src/watchcat.js
Normal file
23
src/watchcat.js
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
const chalk = require('chalk');
|
||||||
|
const dotenv = require('dotenv');
|
||||||
|
const { loadEvents } = require('./events.js');
|
||||||
|
const { Client, GatewayIntentBits } = require('discord.js');
|
||||||
|
|
||||||
|
dotenv.config({ quiet: true });
|
||||||
|
|
||||||
|
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildMembers] });
|
||||||
|
|
||||||
|
client
|
||||||
|
.login(process.env.DISCORD_TOKEN)
|
||||||
|
.then(() => {
|
||||||
|
loadEvents(client);
|
||||||
|
})
|
||||||
|
.catch(err => {
|
||||||
|
if (!err.statusText) {
|
||||||
|
console.error(chalk.red(`${chalk.bold('[BOT]')} Error logging into Discord: ${err}`));
|
||||||
|
} else {
|
||||||
|
console.error(chalk.red(`${chalk.bold('[BOT]')} Error logging into Discord: ${err.statusText}`));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = { client };
|
||||||
Loading…
Reference in a new issue