Cuu.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.3 KiB

  1. import {
  2. BitFieldResolvable,
  3. GatewayIntentsString,
  4. IntentsBitField,
  5. Partials,
  6. } from 'discord.js';
  7. // eslint-disable-next-line @typescript-eslint/no-namespace
  8. export namespace discord {
  9. export const botIntents = (
  10. (process.env.DISCORD_BOT_INTENTS as string)
  11. .split(',')
  12. .map((s) => (
  13. Object.entries(IntentsBitField.Flags).find(([key]) => key === s)?.[1]
  14. ))
  15. .filter((v) => typeof v === 'number') as unknown as BitFieldResolvable<GatewayIntentsString, number>
  16. );
  17. export const botPartials = (
  18. (process.env.DISCORD_BOT_PARTIALS as string)
  19. .split(',')
  20. .map((s) => (
  21. Object.entries(Partials)
  22. .find(([key]) => key === s)?.[1]
  23. ))
  24. .filter((v) => typeof v === 'number') as unknown as Partials[]
  25. );
  26. }
  27. // eslint-disable-next-line @typescript-eslint/no-namespace
  28. export namespace gelbooru {
  29. export const apiUrl = process.env.GELBOORU_API_URL as string;
  30. export const apiKey = process.env.GELBOORU_API_KEY as string;
  31. export const userId = process.env.GELBOORU_API_USER_ID as string;
  32. }
  33. // eslint-disable-next-line @typescript-eslint/no-namespace
  34. export namespace saucenao {
  35. export const apiUrl = process.env.SAUCENAO_API_URL as string;
  36. export const apiKey = process.env.SAUCENAO_API_KEY as string;
  37. }