123456789101112131415161718192021222324252627282930313233343536373839 |
- import { Client, ClientUser, Intents, Util } from "discord.js";
- import { XenforoClient } from "./xenforo";
- export const FORUMS_DOMAIN = "https://custommaid3d2.com";
- export class BotClient {
- public bot = new Client({
- intents: [
- Intents.FLAGS.GUILDS,
- Intents.FLAGS.GUILD_MEMBERS,
- Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
- Intents.FLAGS.GUILD_MESSAGES,
- Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
- Intents.FLAGS.DIRECT_MESSAGES,
- Intents.FLAGS.DIRECT_MESSAGE_REACTIONS,
- ]
- });
- public forum = new XenforoClient(`${FORUMS_DOMAIN}/api`, process.env.FORUM_API_KEY ?? "");
- get botUser(): ClientUser {
- if (!this.bot.user)
- throw new Error("No bot user detected!");
- return this.bot.user;
- }
- get usernameMention(): string {
- return `<@${this.botUser.id}>`;
- }
- get nameMention(): string {
- return `<@!${this.botUser.id}>`;
- }
- get cleanMention(): string {
- return Util.removeMentions(`@${client.botUser.username}`);
- }
- }
- export const client = new BotClient();
|