INNER CODE UNIT · TypeScript
hexToBytes
im4codes/imcodes · server/src/platform/handlers/discord/index.ts:144
function hexToBytes(hex: string): Uint8Array {
const len = hex.length / 2;
const bytes = new Uint8Array(len);
for (let i = 0; i < len; i++) {
bytes[i] = parseInt(hex.slice(i * 2, i * 2 + 2), 16);
}
return bytes;
}
// ── Discord API types (minimal) ───────────────────────────────────────────────
interface DiscordInteraction {
id: string;
type: number;
guild_id?: string;
channel_id?: string;
channel?: { id: string };
member?: { user?: { id: string } };