change: prettier code

This commit is contained in:
TriForMine
2021-10-18 19:13:17 +00:00
committed by GitHub Action
parent c0cf0ebba5
commit b27e7c6d13
5 changed files with 25 additions and 15 deletions

View File

@@ -1,7 +1,7 @@
import type { CreateGuildEmoji } from "../../types/emojis/create_guild_emoji.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import type {Bot} from "../../bot.ts";
import type {SnakeCasedPropertiesDeep} from "../../types/util.ts";
import type { Bot } from "../../bot.ts";
import type { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** Create an emoji in the server. Emojis and animated emojis have a maximum file size of 256kb. Attempting to upload an emoji larger than this limit will fail and return 400 Bad Request and an error message, but not a JSON status code. If a URL is provided to the image parameter, Discordeno will automatically convert it to a base64 string internally. */
export async function createEmoji(bot: Bot, guildId: bigint, name: string, image: string, options: CreateGuildEmoji) {
@@ -11,11 +11,15 @@ export async function createEmoji(bot: Bot, guildId: bigint, name: string, image
image = await bot.utils.urlToBase64(image);
}
const emoji = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Emoji>>("post", bot.constants.endpoints.GUILD_EMOJIS(guildId), {
...options,
name,
image,
});
const emoji = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Emoji>>(
"post",
bot.constants.endpoints.GUILD_EMOJIS(guildId),
{
...options,
name,
image,
}
);
return {
...emoji,

View File

@@ -1,8 +1,10 @@
import type {Bot} from "../../bot.ts";
import type { Bot } from "../../bot.ts";
/** Delete the given emoji. Requires the MANAGE_EMOJIS permission. Returns 204 No Content on success. */
export async function deleteEmoji(bot: Bot, guildId: bigint, id: bigint, reason?: string) {
await bot.utils.requireBotGuildPermissions(guildId, ["MANAGE_EMOJIS"]);
return await bot.rest.runMethod<undefined>(bot.rest,"delete", bot.constants.endpoints.GUILD_EMOJI(guildId, id), { reason });
return await bot.rest.runMethod<undefined>(bot.rest, "delete", bot.constants.endpoints.GUILD_EMOJI(guildId, id), {
reason,
});
}

View File

@@ -1,11 +1,15 @@
import type { Emoji } from "../../types/emojis/emoji.ts";
import type { ModifyGuildEmoji } from "../../types/emojis/modify_guild_emoji.ts";
import type {Bot} from "../../bot.ts";
import type {SnakeCasedPropertiesDeep} from "../../types/util.ts";
import type { Bot } from "../../bot.ts";
import type { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** Modify the given emoji. Requires the MANAGE_EMOJIS permission. */
export async function editEmoji(bot: Bot, guildId: bigint, id: bigint, options: ModifyGuildEmoji) {
await bot.utils.requireBotGuildPermissions(guildId, ["MANAGE_EMOJIS"]);
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<Emoji>>("patch", bot.constants.endpoints.GUILD_EMOJI(guildId, id), options);
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<Emoji>>(
"patch",
bot.constants.endpoints.GUILD_EMOJI(guildId, id),
options
);
}

View File

@@ -1,6 +1,6 @@
import type { Emoji } from "../../types/emojis/emoji.ts";
import { Errors } from "../../types/discordeno/errors.ts";
import {Bot} from "../../bot.ts";
import { Bot } from "../../bot.ts";
/**
* Returns an emoji for the given guild and emoji Id.

View File

@@ -1,4 +1,4 @@
import {Bot} from "../../bot.ts";
import { Bot } from "../../bot.ts";
import type { Emoji } from "../../types/emojis/emoji.ts";
import { Errors } from "../../types/discordeno/errors.ts";
import { Collection } from "../../util/collection.ts";
@@ -9,7 +9,7 @@ import { Collection } from "../../util/collection.ts";
* ⚠️ **If you need this, you are probably doing something wrong. Always use cache.guilds.get()?.emojis
*/
export async function getEmojis(bot: Bot, guildId: bigint, addToCache = true) {
const result = await bot.rest.runMethod<Emoji[]>(bot.rest,"get", bot.constants.endpoints.GUILD_EMOJIS(guildId));
const result = await bot.rest.runMethod<Emoji[]>(bot.rest, "get", bot.constants.endpoints.GUILD_EMOJIS(guildId));
if (addToCache) {
const guild = await bot.cache.guilds.get("guilds", guildId);