Skip to content

Commit

Permalink
feat: setVoiceStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
Faf4a committed Oct 7, 2024
1 parent 80a1d42 commit 510025c
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/functions/setVoiceStatus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const { Routes } = require("discord.js");

/**
* @param {import("..").Data} d
*/
module.exports = async (d) => {
const data = d.util.aoiFunc(d);
if (data.err) return d.error(data.err);

const [voiceID, voiceStatus] = data.inside.splits;

if (voiceStatus.length > 300) return d.aoiError.fnError(d, "custom", {}, "Voice Status cannot be longer than 300 characters");

try {
await d.client.rest.put(Routes.channel(voiceID) + "/voice-status", {
body: {
status: voiceStatus.toString()
}
});
} catch (e) {
return d.aoiError.fnError(d, "custom", {}, e.message);
}

return {
code: d.util.setCode(data)
};
};

0 comments on commit 510025c

Please sign in to comment.