Files
discordeno/helpers/guilds/getVanityUrl.ts
T
Skillz4Killz 3a5bdce32d feat: helpers support strings in args (#2478)
* fix: helpers support strings in args

* fix: fmt
2022-09-15 20:59:02 -05:00

32 lines
920 B
TypeScript

import type { Bot } from "../../bot.ts";
import { BigString } from "../../types/shared.ts";
export type VanityUrl = {
code: string | null;
uses: number;
};
// TODO: Move `VanityUrl` into its own transformer file.
/**
* Gets information about the vanity url of a guild.
*
* @param bot - The bot instance used to make the request
* @param guildId - The ID of the guild to get the vanity url information for.
* @returns An instance of {@link VanityUrl}.
*
* @remarks
* Requires the `MANAGE_GUILD` permission.
*
* The `code` property will be `null` if the guild does not have a set vanity url.
*
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-vanity-url}
*/
export async function getVanityUrl(bot: Bot, guildId: BigString): Promise<VanityUrl> {
return await bot.rest.runMethod<VanityUrl>(
bot.rest,
"GET",
bot.constants.routes.GUILD_VANITY_URL(guildId),
);
}