mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
autoconvert handler messages
This commit is contained in:
@@ -3,7 +3,6 @@ import { rest } from "../../rest/rest.ts";
|
||||
import { structures } from "../../structures/mod.ts";
|
||||
import { DiscordenoEditWebhookMessage } from "../../types/discordeno/edit_webhook_message.ts";
|
||||
import { DiscordAllowedMentionsTypes } from "../../types/messages/allowed_mentions_types.ts";
|
||||
import { DiscordMessage } from "../../types/messages/message.ts";
|
||||
import { Errors } from "../../types/misc/errors.ts";
|
||||
import { endpoints } from "../../util/constants.ts";
|
||||
|
||||
@@ -72,7 +71,7 @@ export async function editSlashResponse(
|
||||
if (!options.messageId) return result as undefined;
|
||||
|
||||
const message = await structures.createDiscordenoMessage(
|
||||
result as DiscordMessage,
|
||||
result,
|
||||
);
|
||||
return message;
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ export async function getGuild(
|
||||
|
||||
const structure = await structures.createDiscordenoGuild(
|
||||
result,
|
||||
(BigInt(guildId) >> 22n) % BigInt(ws.botGatewayData.shards),
|
||||
Number((BigInt(guildId) >> 22n) % BigInt(ws.botGatewayData.shards)),
|
||||
);
|
||||
|
||||
if (options.addToCache) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { cacheHandlers } from "../../cache.ts";
|
||||
import { rest } from "../../rest/rest.ts";
|
||||
import { structures } from "../../structures/mod.ts";
|
||||
import { GuildMember } from "../../types/guilds/guild_member.ts";
|
||||
import { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
|
||||
import { Errors } from "../../types/misc/errors.ts";
|
||||
import { ModifyGuildMember } from "../../types/mod.ts";
|
||||
import { PermissionStrings } from "../../types/permissions/permission_strings.ts";
|
||||
@@ -69,7 +69,7 @@ export async function editMember(
|
||||
|
||||
await requireBotGuildPermissions(guildId, [...requiredPerms]);
|
||||
|
||||
const result = await rest.runMethod<GuildMember>(
|
||||
const result = await rest.runMethod<GuildMemberWithUser>(
|
||||
"patch",
|
||||
endpoints.GUILD_MEMBER(guildId, memberId),
|
||||
camelKeysToSnakeCase(options),
|
||||
|
||||
@@ -4,7 +4,7 @@ import { rest } from "../../rest/rest.ts";
|
||||
import { DiscordenoMember } from "../../structures/member.ts";
|
||||
import { structures } from "../../structures/mod.ts";
|
||||
import { DiscordGatewayIntents } from "../../types/gateway/gateway_intents.ts";
|
||||
import { GuildMember } from "../../types/guilds/guild_member.ts";
|
||||
import { GuildMemberWithUser } from "../../types/guilds/guild_member.ts";
|
||||
import { ListGuildMembers } from "../../types/guilds/list_guild_members.ts";
|
||||
import { Errors } from "../../types/misc/errors.ts";
|
||||
import { Collection } from "../../util/collection.ts";
|
||||
@@ -46,7 +46,7 @@ export async function getMembers(guildId: string, options?: ListGuildMembers) {
|
||||
);
|
||||
}
|
||||
|
||||
const result = (await rest.runMethod<GuildMember[]>(
|
||||
const result = (await rest.runMethod<GuildMemberWithUser[]>(
|
||||
"get",
|
||||
`${endpoints.GUILD_MEMBERS(guildId)}?limit=${
|
||||
membersLeft > 1000 ? 1000 : membersLeft
|
||||
|
||||
@@ -29,7 +29,7 @@ export async function createRole(
|
||||
|
||||
const role = await structures.createDiscordenoRole({
|
||||
role: result,
|
||||
guild_id: guildId,
|
||||
guildId,
|
||||
});
|
||||
const guild = await cacheHandlers.get("guilds", guildId);
|
||||
guild?.roles.set(role.id, role);
|
||||
|
||||
@@ -26,5 +26,5 @@ export async function editRole(
|
||||
},
|
||||
);
|
||||
|
||||
return await structures.createDiscordenoRole(result);
|
||||
return await structures.createDiscordenoRole({ role: result, guildId });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user