@fallencodes/seyfert-utils 1.3.2 → 1.3.6

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.
@@ -1,4 +1,4 @@
1
- import { User, GuildMember, InteractionGuildMember } from 'seyfert';
1
+ import { User, GuildMember, InteractionGuildMember, AnyContext } from 'seyfert';
2
2
  import { APIRoleColors } from 'seyfert/lib/types/index.js';
3
3
  import { ObjectToLower } from 'seyfert/lib/common/index.js';
4
4
  export declare function s(content: string): string;
@@ -14,5 +14,6 @@ export declare function numberToHex(color: number): string;
14
14
  export declare function apiRoleColorsToArray(apiColors: APIRoleColors | ObjectToLower<APIRoleColors>): number[];
15
15
  export declare function getValueFromPath<T extends Record<string, any>>(object: T, path: string): unknown | undefined;
16
16
  export declare function truncateStringArray(array: string[], maxLength?: number, separator?: string): string[];
17
+ export declare function isInstalled(context: AnyContext): boolean;
17
18
  export {};
18
19
  //# sourceMappingURL=utilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utilities.d.ts","sourceRoot":"","sources":["../src/utilities.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAG5D,wBAAgB,CAAC,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEzC;AAGD,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAE/C;AAGD,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAEnD;AAGD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAI3D;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,CAI9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AC,OAAO,CAAC,CAEnD;AAGD,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAI3D;AAGD,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,GAAE,MAAY,GAAG,MAAM,CAI9E;AAED,KAAK,QAAQ,GACX,SAAS,GACT,WAAW,GACX,kBAAkB,GAClB,oBAAoB,GACpB,aAAa,GACb,eAAe,CAAA;AAGjB,wBAAgB,IAAI,CAAC,IAAI,EAAE,IAAI,GAAG,WAAW,GAAG,sBAAsB,EAAE,IAAI,GAAE,QAAoB,GAAG,MAAM,CAW1G;AAGD,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAG/C;AAGD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,OAIhD;AAGD,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,UAExC;AAGD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,aAAa,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAUtG;AAID,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAE5G;AAGD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,SAAS,GAAE,MAAa,EAAE,SAAS,GAAE,MAAa,YActG;AAGD,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CASxD"}
@@ -105,3 +105,16 @@ export function truncateStringArray(array, maxLength = 1000, separator = ', ') {
105
105
  return newArray;
106
106
  }
107
107
  ;
108
+ /* Checks if a command or interaction is from an installed guild. */
109
+ export function isInstalled(context) {
110
+ // @ts-expect-error
111
+ if ('message' in context && context.message?.guildId)
112
+ return true;
113
+ if (context.interaction.context !== 0)
114
+ return false;
115
+ const guildId = context.interaction.authorizingIntegrationOwners['0'];
116
+ if (guildId && guildId !== '0')
117
+ return true;
118
+ return false;
119
+ }
120
+ ;
@@ -6,4 +6,26 @@ export declare const hexRegex: RegExp;
6
6
  export declare const userMentionRegex: RegExp;
7
7
  export declare const roleMentionRegex: RegExp;
8
8
  export declare const channelMentionRegex: RegExp;
9
+ export declare const colors: {
10
+ gold: number;
11
+ orange: number;
12
+ yellow: number;
13
+ red: number;
14
+ darkRed: number;
15
+ lightRed: number;
16
+ burgundy: number;
17
+ olive: number;
18
+ green: number;
19
+ darkGreen: number;
20
+ lightGreen: number;
21
+ blue: number;
22
+ darkBlue: number;
23
+ lightBlue: number;
24
+ purple: number;
25
+ lavender: number;
26
+ darkPurple: number;
27
+ pink: number;
28
+ darkPink: number;
29
+ lightPink: number;
30
+ };
9
31
  //# sourceMappingURL=variables.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../src/variables.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW;;;GAGvB,CAAC;AAGF,eAAO,MAAM,QAAQ,QAA2B,CAAC;AAGjD,eAAO,MAAM,gBAAgB,QAAwB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AAGvD,eAAO,MAAM,mBAAmB,QAAwB,CAAC"}
1
+ {"version":3,"file":"variables.d.ts","sourceRoot":"","sources":["../src/variables.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,WAAW;;;GAGvB,CAAC;AAGF,eAAO,MAAM,QAAQ,QAA2B,CAAC;AAGjD,eAAO,MAAM,gBAAgB,QAAwB,CAAC;AAGtD,eAAO,MAAM,gBAAgB,QAAyB,CAAC;AAGvD,eAAO,MAAM,mBAAmB,QAAwB,CAAC;AAGzD,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;CA0BlB,CAAC"}
@@ -11,3 +11,26 @@ export const userMentionRegex = /<@(?<id>\d{17,20})>/;
11
11
  export const roleMentionRegex = /<@&(?<id>\d{17,20})>/;
12
12
  /* A regex that matches channel mentions. */
13
13
  export const channelMentionRegex = /<#(?<id>\d{17,20})>/;
14
+ /* Default hex colours I use across my projects. */
15
+ export const colors = {
16
+ gold: 0xefbf04,
17
+ orange: 0xffa800,
18
+ yellow: 0xfaff6d,
19
+ red: 0xfa0000,
20
+ darkRed: 0x780606,
21
+ lightRed: 0xfc5757,
22
+ burgundy: 0x660033,
23
+ olive: 0x636b2f,
24
+ green: 0x008d3d,
25
+ darkGreen: 0x004d22,
26
+ lightGreen: 0x5cd25c,
27
+ blue: 0x00a1ff,
28
+ darkBlue: 0x0056ac,
29
+ lightBlue: 0x59c2ff,
30
+ purple: 0x9747ff,
31
+ lavender: 0xbc87fd,
32
+ darkPurple: 0x7517f0,
33
+ pink: 0xff61e7,
34
+ darkPink: 0x9c009c,
35
+ lightPink: 0xffa3f1
36
+ };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fallencodes/seyfert-utils",
3
3
  "type": "module",
4
- "version": "1.3.2",
4
+ "version": "1.3.6",
5
5
  "license": "MIT",
6
6
  "description": "A collection of various utility/helper code I use in my Seyfert projects.",
7
7
  "main": "build/index.js",