Returns all invite codes or URLs of the given guild.
Usage
$getGuildInvites[guildID?;option?;sep?]
Parameters
guildID?
- The guild's ID. (Optional)
option?
- The invite option. (Optional)
sep?
- Separator to separate multiple invites. (Optional)
Source Code
module.exports = {
name: "$getGuildInvites",
type: "djs",
code: async (d) => {
const data = d.util.aoiFunc(d);
const [guildId = d.guild?.id, option = "url", sep = ", "] = data.inside.splits;
const guild = await d.util.getGuild(d, guildId);
if (!guild) return d.aoiError.fnError(d, "guild", { inside: data.inside.guildId });
let invites = await guild.invites.fetch({ cache: false });
data.result = invites.map((x) => option == "url" ? x.url : x.code).join(sep);
return { code: d.util.setCode(data) };
}
};
This function will by default, return the invite codes if the option
is not url
, regardless of the input.