chapterjs 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +2 -2
  2. package/dist/cli/build.js +14 -1
  3. package/dist/cli/dev.js +29 -1
  4. package/dist/cli/env.d.ts +5 -0
  5. package/dist/cli/env.js +39 -3
  6. package/dist/cli/project.d.ts +30 -7
  7. package/dist/cli/project.js +85 -11
  8. package/dist/cli/redis.d.ts +23 -0
  9. package/dist/cli/redis.js +57 -0
  10. package/dist/cli/start.js +43 -17
  11. package/dist/cli/test.js +4 -2
  12. package/dist/events/registry.d.ts +252 -239
  13. package/dist/events/registry.js +125 -100
  14. package/dist/index.d.ts +4 -2
  15. package/dist/index.js +1 -0
  16. package/dist/ranking/declaration.d.ts +12 -0
  17. package/dist/ranking/declaration.js +48 -0
  18. package/dist/ranking/ranking.d.ts +102 -0
  19. package/dist/ranking/ranking.js +129 -0
  20. package/dist/redis/client.d.ts +36 -0
  21. package/dist/redis/client.js +252 -0
  22. package/dist/redis/protocol.d.ts +22 -0
  23. package/dist/redis/protocol.js +99 -0
  24. package/dist/redis/url.d.ts +24 -0
  25. package/dist/redis/url.js +50 -0
  26. package/dist/store/backend.d.ts +49 -4
  27. package/dist/store/backend.js +66 -11
  28. package/dist/store/declaration.d.ts +3 -0
  29. package/dist/store/declaration.js +8 -3
  30. package/dist/store/file-backend.d.ts +3 -1
  31. package/dist/store/file-backend.js +29 -0
  32. package/dist/store/ipc-backend.d.ts +24 -1
  33. package/dist/store/ipc-backend.js +49 -0
  34. package/dist/store/memory-backend.d.ts +4 -2
  35. package/dist/store/memory-backend.js +27 -1
  36. package/dist/store/ranking-backend.d.ts +45 -0
  37. package/dist/store/ranking-backend.js +82 -0
  38. package/dist/store/redis-backend.d.ts +38 -0
  39. package/dist/store/redis-backend.js +245 -0
  40. package/dist/store/redis-ranking.d.ts +15 -0
  41. package/dist/store/redis-ranking.js +69 -0
  42. package/dist/store/scope.d.ts +11 -0
  43. package/dist/store/scope.js +23 -0
  44. package/dist/store/store.d.ts +39 -5
  45. package/dist/store/store.js +79 -32
  46. package/dist/structures/invite.d.ts +6 -0
  47. package/dist/structures/invite.js +11 -0
  48. package/package.json +1 -1
@@ -1,6 +1,7 @@
1
1
  import type { Snowflake } from '../discord/types/common.js';
2
2
  import type { RawInvite, RawInviteMetadata } from '../discord/types/invite.js';
3
3
  import { Structure } from './base.js';
4
+ import type { GuildChannel } from './channel.js';
4
5
  import type { Context } from './context.js';
5
6
  import type { User } from './user.js';
6
7
  export type InviteData = Omit<RawInvite, 'inviter'> & Partial<RawInviteMetadata>;
@@ -20,6 +21,11 @@ export declare class Invite extends Structure<InviteData> {
20
21
  get guildId(): Snowflake | null;
21
22
  /** The id of the channel the invite leads to. */
22
23
  get channelId(): Snowflake | null;
24
+ /**
25
+ * The channel the invite leads to, when the bot knows it. It never sends
26
+ * a request.
27
+ */
28
+ get channel(): GuildChannel | null;
23
29
  /** When the invite stops working; `null` when it never does. */
24
30
  get expiresAt(): Date | null;
25
31
  /** How many times the invite was used, when Discord says it. */
@@ -27,6 +27,17 @@ export class Invite extends Structure {
27
27
  get channelId() {
28
28
  return dataOf(this).channel?.id ?? null;
29
29
  }
30
+ /**
31
+ * The channel the invite leads to, when the bot knows it. It never sends
32
+ * a request.
33
+ */
34
+ get channel() {
35
+ const id = this.channelId;
36
+ const found = id ? ctxOf(this).cache.channels.get(id) : undefined;
37
+ return found && found.guildId !== null && !found.isThread()
38
+ ? found
39
+ : null;
40
+ }
30
41
  /** When the invite stops working; `null` when it never does. */
31
42
  get expiresAt() {
32
43
  return toDate(dataOf(this).expires_at);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chapterjs",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "The Discord framework: ultra simple, but ultra customizable. Your files become a bot, typed end to end, with nothing to register.",
5
5
  "keywords": [
6
6
  "discord",