mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
fix: snakelize request body
This commit is contained in:
@@ -5,11 +5,12 @@ import { structures } from "../../structures/mod.ts";
|
||||
import type { CreateGuild } from "../../types/guilds/create_guild.ts";
|
||||
import type { Guild } from "../../types/guilds/guild.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { snakelize } from "../../util/utils.ts";
|
||||
import { getMember } from "../members/get_member.ts";
|
||||
|
||||
/** Create a new guild. Returns a guild object on success. Fires a Guild Create Gateway event. This endpoint can be used only by bots in less than 10 guilds. */
|
||||
export async function createGuild(options: CreateGuild) {
|
||||
const result = await rest.runMethod<Guild>("post", endpoints.GUILDS, options);
|
||||
const result = await rest.runMethod<Guild>("post", endpoints.GUILDS, snakelize(options));
|
||||
|
||||
const guild = await structures.createDiscordenoGuild(result, 0);
|
||||
// MANUALLY CACHE THE GUILD
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { Guild } from "../../types/guilds/guild.ts";
|
||||
import type { ModifyGuild } from "../../types/guilds/modify_guild.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
import { requireBotGuildPermissions } from "../../util/permissions.ts";
|
||||
import { urlToBase64 } from "../../util/utils.ts";
|
||||
import { snakelize, urlToBase64 } from "../../util/utils.ts";
|
||||
import { ws } from "../../ws/ws.ts";
|
||||
|
||||
/** Modify a guilds settings. Requires the MANAGE_GUILD permission. */
|
||||
@@ -24,7 +24,7 @@ export async function editGuild(guildId: bigint, options: ModifyGuild) {
|
||||
options.splash = await urlToBase64(options.splash);
|
||||
}
|
||||
|
||||
const result = await rest.runMethod<Guild>("patch", endpoints.GUILDS_BASE(guildId), options);
|
||||
const result = await rest.runMethod<Guild>("patch", endpoints.GUILDS_BASE(guildId), snakelize(options));
|
||||
|
||||
const cached = await cacheHandlers.get("guilds", guildId);
|
||||
return structures.createDiscordenoGuild(
|
||||
|
||||
Reference in New Issue
Block a user