Create a discord guild (bot need to be in less than 10 guilds).
$create-guild[GuildName;GuildIcon;ReturnInviteCode(true/false)]
Example: $create-guild[Athenox's Test Guild;$authorAvatar;true]
Code:
name: "$create-guild",
type: "djs",
code: async (d) => {
const data = d.util.aoiFunc(d);
const [name = "{Default Name}", icon = "{Default Icon}", invite = "true"] = data.inside.splits;
let result;
async function createGuild(client) {
try {
const guild = await client.guilds.create({ name: `${name}`, icon: `${icon}` });
const inviteCode = await guild.invites.create(guild.channels.cache.filter(c => c.isTextBased()).first(), { maxAge: 0 });
console.log(`New guild created: ${inviteCode.code}`);
if (invite === "true") {
result = inviteCode.code;
}
} catch (error) {
console.error(error);
result = `An error occured : \n\n\`\`\`js\n${error.message}\n\n\`\`\``;
}
}
await createGuild(d.client);
data.result = result;
return {
code: d.util.setCode(data)
};
}
});```
(Pls, add this to the official aoi.js package)