commit handler

main
Matthew 2024-01-24 10:57:37 -05:00
commit 6b7ab58359
Signed by: matthew
SSH Key Fingerprint: SHA256:piIXekA9q1p0ZGi4ogFbNY1embip5Ytbi3v8AZ8UYq4
3 changed files with 54 additions and 0 deletions

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
# IntelliJ project files
.idea
*.iml
out
gen
# Configuration files
token.json
# Package files
node_modules

18
Ramirez.ts Normal file
View File

@ -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;
}
}

25
main.ts Normal file
View File

@ -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();