client.ts 799 B

1234567891011121314151617181920212223242526272829
  1. import { Client, ClientUser, Util } from "discord.js";
  2. import { XenforoClient } from "./xenforo";
  3. export const FORUMS_DOMAIN = "https://custommaid3d2.com";
  4. export class BotClient {
  5. public bot = new Client();
  6. public forum = new XenforoClient(`${FORUMS_DOMAIN}/api`, process.env.FORUM_API_KEY ?? "");
  7. get botUser(): ClientUser {
  8. if (!this.bot.user)
  9. throw new Error("No bot user detected!");
  10. return this.bot.user;
  11. }
  12. get usernameMention(): string {
  13. return `<@${this.botUser.id}>`;
  14. }
  15. get nameMention(): string {
  16. return `<@!${this.botUser.id}>`;
  17. }
  18. get cleanMention(): string {
  19. return Util.removeMentions(`@${client.botUser.username}`);
  20. }
  21. }
  22. export const client = new BotClient();