mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 18:00:08 +00:00
change: prettier code
This commit is contained in:
committed by
GitHub Action
parent
5c82abc3d2
commit
252fe62b72
@@ -1,14 +1,14 @@
|
||||
import type { AddGuildDiscoverySubcategory } from "../../types/discovery/add_guild_discovery_subcategory.ts";
|
||||
import {Bot} from "../../bot.ts";
|
||||
import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
|
||||
/** Add a discovery subcategory to the guild. Requires the `MANAGE_GUILD` permission. */
|
||||
export async function addDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) {
|
||||
await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<AddGuildDiscoverySubcategory>>(
|
||||
bot.rest,
|
||||
"post",
|
||||
bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId)
|
||||
bot.rest,
|
||||
"post",
|
||||
bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,20 @@
|
||||
import type { DiscoveryMetadata } from "../../types/discovery/discovery_metadata.ts";
|
||||
import type { ModifyGuildDiscoveryMetadata } from "../../types/discovery/modify_guild_discovery_metadata.ts";
|
||||
import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
|
||||
import {Bot} from "../../bot.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
|
||||
/** Modify the discovery metadata for the guild. Requires the MANAGE_GUILD permission. Returns the updated discovery metadata object on success. */
|
||||
export async function editDiscovery(bot: Bot, guildId: bigint, data: ModifyGuildDiscoveryMetadata) {
|
||||
await bot.utils.requireBotGuildPermissions(guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<DiscoveryMetadata>>(bot.rest,"patch", bot.constants.endpoints.DISCOVERY_METADATA(guildId), {
|
||||
primary_category_id: data.primaryCategoryId,
|
||||
keywords: data.keywords,
|
||||
emoji_discoverability_enabled: data.emojiDiscoverabilityEnabled,
|
||||
});
|
||||
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<DiscoveryMetadata>>(
|
||||
bot.rest,
|
||||
"patch",
|
||||
bot.constants.endpoints.DISCOVERY_METADATA(guildId),
|
||||
{
|
||||
primary_category_id: data.primaryCategoryId,
|
||||
keywords: data.keywords,
|
||||
emoji_discoverability_enabled: data.emojiDiscoverabilityEnabled,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
import type { DiscoveryMetadata } from "../../types/discovery/discovery_metadata.ts";
|
||||
import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
|
||||
import {Bot} from "../../bot.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
|
||||
/** Returns the discovery metadata object for the guild. Requires the `MANAGE_GUILD` permission. */
|
||||
export async function getDiscovery(bot: Bot, guildId: bigint) {
|
||||
await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<DiscoveryMetadata>>(bot.rest,"get", bot.constants.endpoints.DISCOVERY_METADATA(guildId));
|
||||
return await bot.rest.runMethod<SnakeCasedPropertiesDeep<DiscoveryMetadata>>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.DISCOVERY_METADATA(guildId)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,11 +1,17 @@
|
||||
import type { DiscoveryCategory } from "../../types/discovery/discovery_category.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
import {Bot} from "../../bot.ts";
|
||||
import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
|
||||
/** Returns a Collection (mapped by Id of the discovery category object) of discovery category objects that can be used when editing guilds */
|
||||
export async function getDiscoveryCategories(bot: Bot) {
|
||||
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<DiscoveryCategory>[]>(bot.rest,"get", bot.constants.endpoints.DISCOVERY_CATEGORIES);
|
||||
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<DiscoveryCategory>[]>(
|
||||
bot.rest,
|
||||
"get",
|
||||
bot.constants.endpoints.DISCOVERY_CATEGORIES
|
||||
);
|
||||
|
||||
return new Collection<number, SnakeCasedPropertiesDeep<DiscoveryCategory>>(result.map((category) => [category.id, category]));
|
||||
return new Collection<number, SnakeCasedPropertiesDeep<DiscoveryCategory>>(
|
||||
result.map((category) => [category.id, category])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
import {Bot} from "../../bot.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
|
||||
/** Removes a discovery subcategory from the guild. Requires the MANAGE_GUILD permission. Returns a 204 No Content on success. */
|
||||
export async function removeDiscoverySubcategory(bot: Bot, guildId: bigint, categoryId: number) {
|
||||
await bot.utils.requireBotGuildPermissions(bot, guildId, ["MANAGE_GUILD"]);
|
||||
|
||||
return await bot.rest.runMethod<undefined>(bot.rest,"delete", bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId));
|
||||
return await bot.rest.runMethod<undefined>(
|
||||
bot.rest,
|
||||
"delete",
|
||||
bot.constants.endpoints.DISCOVERY_SUBCATEGORY(guildId, categoryId)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
import type { ValidateDiscoverySearchTerm } from "../../types/discovery/validate_discovery_search_term.ts";
|
||||
import {Bot} from "../../bot.ts";
|
||||
import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
|
||||
import { Bot } from "../../bot.ts";
|
||||
import { SnakeCasedPropertiesDeep } from "../../types/util.ts";
|
||||
|
||||
export async function validDiscoveryTerm(bot: Bot, term: string) {
|
||||
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<ValidateDiscoverySearchTerm>>("get", bot.constants.endpoints.DISCOVERY_VALID_TERM, { term });
|
||||
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<ValidateDiscoverySearchTerm>>(
|
||||
"get",
|
||||
bot.constants.endpoints.DISCOVERY_VALID_TERM,
|
||||
{ term }
|
||||
);
|
||||
|
||||
return result.valid;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user