From 6b7ab58359ce95acff5382b3a8fcb4fc4e8c02cb Mon Sep 17 00:00:00 2001 From: Matthew Date: Wed, 24 Jan 2024 10:57:37 -0500 Subject: [PATCH] commit handler --- .gitignore | 11 +++++++++++ Ramirez.ts | 18 ++++++++++++++++++ main.ts | 25 +++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100644 .gitignore create mode 100644 Ramirez.ts create mode 100644 main.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d0fd32f --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# IntelliJ project files +.idea +*.iml +out +gen + +# Configuration files +token.json + +# Package files +node_modules diff --git a/Ramirez.ts b/Ramirez.ts new file mode 100644 index 0000000..4e884cc --- /dev/null +++ b/Ramirez.ts @@ -0,0 +1,18 @@ +import { Client, GatewayIntentBits, Partials } from "discord.js"; + +export default class Ramirez { + private readonly c: Client; + private token: string | undefined; + + constructor(token?: string) { + this.c = new Client({ + intents: [GatewayIntentBits.DirectMessages, GatewayIntentBits.MessageContent, GatewayIntentBits.GuildMessages, GatewayIntentBits.GuildPresences], + partials: [Partials.GuildMember, Partials.Message, Partials.User, Partials.Channel], + }); + this.token = token; + } + + public get client() { + return this.c; + } +} diff --git a/main.ts b/main.ts new file mode 100644 index 0000000..c5a5910 --- /dev/null +++ b/main.ts @@ -0,0 +1,25 @@ +import Ramirez from "./Ramirez"; +import { promises as fs } from "fs"; + + +async function main() { + const parsed : { val?: string } = JSON.parse(await fs.readFile("./token.json", "utf8")); + const ramirez = new Ramirez(); + await ramirez.client.login(parsed.val); + + ramirez.client.once("ready", () => { + console.log("Handler is ready.") + ramirez.client.user?.setStatus("idle"); + }); + ramirez.client.on("messageCreate", message => { + if (message.author.bot) return; + if (message.channel.type == 1) { + message.reply("Hi, thanks for reaching out. Unfortunately, Management has decided to retire this modmailbot as of 2024-01-23 @ 21:33 and this service is no longer available. We are proceeding with this change in order to simplify our support process.\n\n-If you need help with Cloud Services or need to speak to a Technician, please DM <@650944330789552128> instead.\n-If you need assistance from a Server Moderator immediately. please ping the <@&455972169449734144> role within the server.\n-Programming support is located in <#506970598631538708>.\n\nThank you for your understanding ++LOC Management"); + } + }); + ramirez.client.on("raw", r => { + // console.log(r); + }); +} + +main();