-
Notifications
You must be signed in to change notification settings - Fork 748
Closed
Description
Check for existing issues
- Completed
Describe the bug / provide steps to reproduce it
async readFile(encoding) {
if (segments.length === 4 && segments[0] === 'bots' && segments[2] === 'commands') {
const { botId, commandId } = resolvePath();
const command = await apiRequest(`/bots/${botId}/commands/${commandId}`);
if (!command) throw new Error(`Command not found: ${commandId}`);
let code = command.code;
const encoder = new TextEncoder();
const arrayBuffer = encoder.encode(code); // Convert string to ArrayBuffer (UTF-8)
if (encoding) {
// If encoding is provided, decode the file content
if (encodings?.decode) {
const decoded = await encodings.decode(code, encoding);
if (decoded) return decoded;
}
// If no specific decoding method is found, use a fallback
return helpers.decodeText(code, encoding);
}
return arrayBuffer;
}
throw new Error('Not a file or unsupported path');
},Environment
957
If applicable, add mockups / screenshots regarding your vision
No response
If applicable, attach your Acode.log file to this issue.
No response
Metadata
Metadata
Assignees
Labels
No labels
