MCPcopy Create free account
hub / github.com/countr/countr / generateModuleMenuReply

Function generateModuleMenuReply

src/commands/chatInput/modules.ts:107–145  ·  view source on GitHub ↗
(name: keyof typeof modules, countingChannel: CountingChannelSchema, uniqueId: string)

Source from the content-addressed store, hash-verified

105}
106
107function generateModuleMenuReply(name: keyof typeof modules, countingChannel: CountingChannelSchema, uniqueId: string): InteractionReplyOptions & InteractionUpdateOptions {
108 const { description, image, incompatible } = modules[name];
109 return {
110 embeds: [
111 {
112 title: `Module Information • ${name}`,
113 description: description + (incompatible ? `\n\n*Incompatible with modules ${incompatible.map(module => `\`${module}\``).join(", ")}*` : ""),
114 ...image && { image: { url: image } },
115 color: config.colors.primary,
116 },
117 ],
118 components: [
119 {
120 type: ComponentType.ActionRow,
121 components: [
122 countingChannel.modules.includes(name) ?
123 {
124 type: ComponentType.Button,
125 label: "Module is enabled (click to disable)",
126 customId: `${uniqueId}:disable`,
127 style: ButtonStyle.Primary,
128 } :
129 {
130 type: ComponentType.Button,
131 label: "Module is disabled (click to enable)",
132 customId: `${uniqueId}:enable`,
133 style: ButtonStyle.Secondary,
134 },
135 {
136 type: ComponentType.Button,
137 label: "Go back",
138 customId: `${uniqueId}:back`,
139 style: ButtonStyle.Secondary,
140 },
141 ],
142 },
143 ],
144 };
145}

Callers 2

callbackFunction · 0.85
moduleDetailsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected