@argentina-community/channels-utils 2.0.1 → 2.0.2

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.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["ChannelTypeMap: Record<ChannelType, ChannelConstructor>"],"sources":["../src/channel-type.ts","../src/channel-type.utils.ts"],"sourcesContent":["import {\n\tCategoryChannel,\n\tChannel,\n\tChannelType,\n\tDMChannel,\n\tForumChannel,\n\tMediaChannel,\n\tNewsChannel,\n\tStageChannel,\n\tTextChannel,\n\tThreadChannel,\n\tVoiceChannel,\n} from 'discord.js';\n\nexport type ChannelConstructor =\n\t| typeof CategoryChannel\n\t| typeof TextChannel\n\t| typeof NewsChannel\n\t| typeof ForumChannel\n\t| typeof MediaChannel\n\t| typeof TextChannel\n\t| typeof ThreadChannel\n\t| typeof VoiceChannel\n\t| typeof StageChannel\n\t| typeof DMChannel;\n\nexport const ChannelTypeMap: Record<ChannelType, ChannelConstructor> = {\n\t/**\n\t * Meta channels\n\t */\n\n\t[ChannelType.GuildCategory]: CategoryChannel,\n\n\t/**\n\t * Text channels\n\t */\n\n\t[ChannelType.GuildText]: TextChannel,\n\t[ChannelType.GuildAnnouncement]: NewsChannel,\n\n\t/**\n\t * Feature channels\n\t */\n\n\t[ChannelType.GuildForum]: ForumChannel,\n\t[ChannelType.GuildMedia]: MediaChannel,\n\t[ChannelType.GuildDirectory]: TextChannel,\n\n\t/**\n\t * Threads/nested channels\n\t */\n\n\t[ChannelType.PublicThread]: ThreadChannel,\n\t[ChannelType.PrivateThread]: ThreadChannel,\n\t[ChannelType.AnnouncementThread]: ThreadChannel,\n\n\t/**\n\t * Voice channels\n\t */\n\n\t[ChannelType.GuildVoice]: VoiceChannel,\n\t[ChannelType.GuildStageVoice]: StageChannel,\n\n\t/**\n\t * User channels\n\t */\n\n\t[ChannelType.DM]: DMChannel,\n\t[ChannelType.GroupDM]: DMChannel,\n} as const;\n\nexport type ChannelTypeMap<T extends ChannelType> = Extract<\n\tChannel,\n\t{ type: T }\n>;\n\n// export interface ChannelTypeMap {\n// \t/**\n// \t * Meta channels\n// \t */\n\n// \t[ChannelType.GuildCategory]: CategoryChannel;\n\n// \t/**\n// \t * Text channels\n// \t */\n\n// \t[ChannelType.GuildText]: TextChannel;\n// \t[ChannelType.GuildAnnouncement]: NewsChannel;\n\n// \t/**\n// \t * Feature channels\n// \t */\n\n// \t[ChannelType.GuildForum]: ForumChannel;\n// \t[ChannelType.GuildMedia]: MediaChannel;\n// \t[ChannelType.GuildDirectory]: TextChannel;\n\n// \t/**\n// \t * Threads/nested channels\n// \t */\n\n// \t[ChannelType.PublicThread]: ThreadChannel;\n// \t[ChannelType.PrivateThread]: ThreadChannel;\n// \t[ChannelType.AnnouncementThread]: ThreadChannel;\n\n// \t/**\n// \t * Voice channels\n// \t */\n\n// \t[ChannelType.GuildVoice]: VoiceChannel;\n// \t[ChannelType.GuildStageVoice]: StageChannel;\n\n// \t/**\n// \t * User channels\n// \t */\n\n// \t[ChannelType.DM]: DMChannel;\n// \t[ChannelType.GroupDM]: DMChannel;\n// }\n","import { Channel, ChannelType } from 'discord.js';\n\nimport { ChannelTypeMap } from './channel-type.js';\n\n/**\n * @param value Type to get the indexing key from\n * @returns the indexing key on the type enum\n */\nexport function getChannelTypeKey(\n\tvalue: ChannelType,\n): keyof typeof ChannelType {\n\treturn ChannelType[value] as keyof typeof ChannelType;\n}\n\n/**\n * @param type the channel type to compare agaisnt\n * @param channel the value to check\n * @returns whether channel is of type provided\n */\nexport function isChannelOfType<T extends ChannelType>(\n\ttype: T,\n\tchannel: Channel,\n): channel is ChannelTypeMap<T> {\n\treturn channel.type === type && channel instanceof ChannelTypeMap[type];\n}\n"],"mappings":";;;AA0BA,MAAaA,iBAA0D;EAKrE,YAAY,gBAAgB;EAM5B,YAAY,YAAY;EACxB,YAAY,oBAAoB;EAMhC,YAAY,aAAa;EACzB,YAAY,aAAa;EACzB,YAAY,iBAAiB;EAM7B,YAAY,eAAe;EAC3B,YAAY,gBAAgB;EAC5B,YAAY,qBAAqB;EAMjC,YAAY,aAAa;EACzB,YAAY,kBAAkB;EAM9B,YAAY,KAAK;EACjB,YAAY,UAAU;;;;;;;;;AC5DxB,SAAgB,kBACf,OAC2B;AAC3B,QAAO,YAAY;;;;;;;AAQpB,SAAgB,gBACf,MACA,SAC+B;AAC/B,QAAO,QAAQ,SAAS,QAAQ,mBAAmB,eAAe"}
1
+ {"version":3,"file":"index.js","names":["ChannelTypeMap: Record<ChannelType, ChannelConstructor>"],"sources":["../src/channel-type.ts","../src/channel-type.utils.ts"],"sourcesContent":["import {\n\tCategoryChannel,\n\tChannel,\n\tChannelType,\n\tDMChannel,\n\tForumChannel,\n\tMediaChannel,\n\tNewsChannel,\n\tStageChannel,\n\tTextChannel,\n\tThreadChannel,\n\tVoiceChannel,\n} from 'discord.js';\n\nexport type ChannelConstructor =\n\t| typeof CategoryChannel\n\t| typeof TextChannel\n\t| typeof NewsChannel\n\t| typeof ForumChannel\n\t| typeof MediaChannel\n\t| typeof TextChannel\n\t| typeof ThreadChannel\n\t| typeof VoiceChannel\n\t| typeof StageChannel\n\t| typeof DMChannel;\n\nexport const ChannelTypeMap: Record<ChannelType, ChannelConstructor> = {\n\t/**\n\t * Meta channels\n\t */\n\n\t[ChannelType.GuildCategory]: CategoryChannel,\n\n\t/**\n\t * Text channels\n\t */\n\n\t[ChannelType.GuildText]: TextChannel,\n\t[ChannelType.GuildAnnouncement]: NewsChannel,\n\n\t/**\n\t * Feature channels\n\t */\n\n\t[ChannelType.GuildForum]: ForumChannel,\n\t[ChannelType.GuildMedia]: MediaChannel,\n\t[ChannelType.GuildDirectory]: TextChannel,\n\n\t/**\n\t * Threads/nested channels\n\t */\n\n\t[ChannelType.PublicThread]: ThreadChannel,\n\t[ChannelType.PrivateThread]: ThreadChannel,\n\t[ChannelType.AnnouncementThread]: ThreadChannel,\n\n\t/**\n\t * Voice channels\n\t */\n\n\t[ChannelType.GuildVoice]: VoiceChannel,\n\t[ChannelType.GuildStageVoice]: StageChannel,\n\n\t/**\n\t * User channels\n\t */\n\n\t[ChannelType.DM]: DMChannel,\n\t[ChannelType.GroupDM]: DMChannel,\n} as const;\n\nexport type ChannelTypeMap<T extends ChannelType> = Extract<\n\tChannel,\n\t{ type: T }\n>;\n","import { Channel, ChannelType } from 'discord.js';\n\nimport { ChannelTypeMap } from './channel-type.js';\n\n/**\n * @param value Type to get the indexing key from\n * @returns the indexing key on the type enum\n */\nexport function getChannelTypeKey(\n\tvalue: ChannelType,\n): keyof typeof ChannelType {\n\treturn ChannelType[value] as keyof typeof ChannelType;\n}\n\n/**\n * @param type the channel type to compare agaisnt\n * @param channel the value to check\n * @returns whether channel is of type provided\n */\nexport function isChannelOfType<T extends ChannelType>(\n\ttype: T,\n\tchannel: Channel,\n): channel is ChannelTypeMap<T> {\n\treturn channel.type === type && channel instanceof ChannelTypeMap[type];\n}\n"],"mappings":";;;AA0BA,MAAaA,iBAA0D;EAKrE,YAAY,gBAAgB;EAM5B,YAAY,YAAY;EACxB,YAAY,oBAAoB;EAMhC,YAAY,aAAa;EACzB,YAAY,aAAa;EACzB,YAAY,iBAAiB;EAM7B,YAAY,eAAe;EAC3B,YAAY,gBAAgB;EAC5B,YAAY,qBAAqB;EAMjC,YAAY,aAAa;EACzB,YAAY,kBAAkB;EAM9B,YAAY,KAAK;EACjB,YAAY,UAAU;CACvB;;;;;;;;AC7DD,SAAgB,kBACf,OAC2B;AAC3B,QAAO,YAAY;;;;;;;AAQpB,SAAgB,gBACf,MACA,SAC+B;AAC/B,QAAO,QAAQ,SAAS,QAAQ,mBAAmB,eAAe"}
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.0.1",
2
+ "version": "2.0.2",
3
3
  "name": "@argentina-community/channels-utils",
4
4
  "author": "0xar-ds <sadden-rope-sleek@duck.com>",
5
5
  "license": "GPL-3.0-only",
@@ -22,7 +22,7 @@
22
22
  ],
23
23
  "devDependencies": {
24
24
  "@types/express": "5.0.3",
25
- "@types/node": "24.3.0",
25
+ "@types/node": "24.3.1",
26
26
  "globals": "16.3.0",
27
27
  "source-map-support": "0.5.21",
28
28
  "ts-loader": "9.5.4",