dressed
Version:
A sleek, serverless-ready Discord bot framework.
111 lines • 3.22 kB
JavaScript
import { Routes } from "discord-api-types/v10";
import { callDiscord } from "../utils/call-discord.js";
import { botEnv } from "../utils/env.js";
/**
* Returns a list of emoji objects for the given guild.
* @param guild The guild to get the emojis from
*/
export async function listEmojis(guild) {
const res = await callDiscord(Routes.guildEmojis(guild), {
method: "GET",
});
return res.json();
}
/**
* Returns an emoji object for the given guild and emoji.
* @param guild The guild to get the emoji from
* @param emoji The emoji to get
*/
export async function getEmoji(guild, emoji) {
const res = await callDiscord(Routes.guildEmoji(guild, emoji), {
method: "GET",
});
return res.json();
}
/**
* Create a new emoji for the guild.
* @param guild The guild to create the emoji for
* @param data The data for the new emoji
*/
export async function createEmoji(guild, data) {
const res = await callDiscord(Routes.guildEmojis(guild), {
method: "POST",
body: data,
});
return res.json();
}
/**
* Modify the given guild emoji.
* @param guild The guild to modify the emoji in
* @param emoji The emoji to modify
* @param data The new data for the emoji
*/
export async function modifyEmoji(guild, emoji, data) {
const res = await callDiscord(Routes.guildEmoji(guild, emoji), {
method: "PATCH",
body: data,
});
return res.json();
}
/**
* Delete the given guild emoji.
* @param guild The guild to delete the emoji from
* @param emoji The emoji to delete
*/
export async function deleteEmoji(guild, emoji) {
await callDiscord(Routes.guildEmoji(guild, emoji), {
method: "DELETE",
});
}
/**
* Returns an object containing a list of emoji objects for the given application.
*/
export async function listApplicationEmojis() {
const res = await callDiscord(Routes.applicationEmojis(botEnv.DISCORD_APP_ID), {
method: "GET",
});
return res.json();
}
/**
* Returns an emoji object for the given application and emoji IDs.
* @param emoji The emoji to get
*/
export async function getApplicationEmoji(emoji) {
const res = await callDiscord(Routes.applicationEmoji(botEnv.DISCORD_APP_ID, emoji), {
method: "GET",
});
return res.json();
}
/**
* Create a new emoji for the application.
* @param data The data for the new emoji
*/
export async function createApplicationEmoji(data) {
const res = await callDiscord(Routes.applicationEmojis(botEnv.DISCORD_APP_ID), {
method: "POST",
body: data,
});
return res.json();
}
/**
* Modify the given emoji.
* @param emoji The emoji to modify
* @param data The new data for the emoji
*/
export async function modifyApplicationEmoji(emoji, data) {
const res = await callDiscord(Routes.applicationEmoji(botEnv.DISCORD_APP_ID, emoji), {
method: "PATCH",
body: data,
});
return res.json();
}
/**
* Delete the given emoji.
* @param emoji The emoji to delete
*/
export async function deleteApplicationEmoji(emoji) {
await callDiscord(Routes.applicationEmoji(botEnv.DISCORD_APP_ID, emoji), {
method: "DELETE",
});
}
//# sourceMappingURL=emojis.js.map