MCPcopy Create free account
hub / github.com/codebymitch/TitanBot / normalizeCommandData

Function normalizeCommandData

src/handlers/helpSelectMenus.js:100–119  ·  view source on GitHub ↗
(command)

Source from the content-addressed store, hash-verified

98}
99
100function normalizeCommandData(command) {
101 const rawData = command?.data;
102 if (!rawData) {
103 return null;
104 }
105
106 const jsonData = typeof rawData.toJSON === 'function' ? rawData.toJSON() : rawData;
107 if (!jsonData?.name) {
108 return null;
109 }
110
111 return {
112 ...jsonData,
113 options: Array.isArray(jsonData.options)
114 ? jsonData.options.map((option) =>
115 typeof option?.toJSON === 'function' ? option.toJSON() : option,
116 )
117 : [],
118 };
119}
120
121async function createCategoryCommandsMenu(category, client) {
122 const categoryName = formatCategoryName(category);

Callers 3

buildHelpEntriesFunction · 0.85
createAllCommandsMenuFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected