mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
Merge branch 'fix-handlers-channels' into fix-helpers
This commit is contained in:
@@ -9,7 +9,7 @@ export async function deleteChannel(
|
|||||||
guildId: string,
|
guildId: string,
|
||||||
channelId: string,
|
channelId: string,
|
||||||
reason?: string,
|
reason?: string,
|
||||||
) {
|
): Promise<undefined> {
|
||||||
await requireBotGuildPermissions(guildId, ["MANAGE_CHANNELS"]);
|
await requireBotGuildPermissions(guildId, ["MANAGE_CHANNELS"]);
|
||||||
|
|
||||||
const guild = await cacheHandlers.get("guilds", guildId);
|
const guild = await cacheHandlers.get("guilds", guildId);
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export async function deleteChannelOverwrite(
|
|||||||
guildId: string,
|
guildId: string,
|
||||||
channelId: string,
|
channelId: string,
|
||||||
overwriteId: string,
|
overwriteId: string,
|
||||||
) {
|
): Promise<undefined> {
|
||||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||||
|
|
||||||
const result = await rest.runMethod(
|
const result = await rest.runMethod(
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { rest } from "../../rest/rest.ts";
|
import { rest } from "../../rest/rest.ts";
|
||||||
|
import { ModifyChannel } from "../../types/channels/modify_channel.ts";
|
||||||
import { endpoints } from "../../util/constants.ts";
|
import { endpoints } from "../../util/constants.ts";
|
||||||
import {
|
import {
|
||||||
calculateBits,
|
calculateBits,
|
||||||
@@ -8,7 +9,7 @@ import {
|
|||||||
/** Update a channel's settings. Requires the `MANAGE_CHANNELS` permission for the guild. */
|
/** Update a channel's settings. Requires the `MANAGE_CHANNELS` permission for the guild. */
|
||||||
export async function editChannel(
|
export async function editChannel(
|
||||||
channelId: string,
|
channelId: string,
|
||||||
options: ChannelEditOptions,
|
options: ModifyChannel,
|
||||||
reason?: string,
|
reason?: string,
|
||||||
) {
|
) {
|
||||||
await requireBotChannelPermissions(channelId, ["MANAGE_CHANNELS"]);
|
await requireBotChannelPermissions(channelId, ["MANAGE_CHANNELS"]);
|
||||||
@@ -47,7 +48,7 @@ export async function editChannel(
|
|||||||
// deno-lint-ignore camelcase
|
// deno-lint-ignore camelcase
|
||||||
user_limit: options.userLimit,
|
user_limit: options.userLimit,
|
||||||
// deno-lint-ignore camelcase
|
// deno-lint-ignore camelcase
|
||||||
permission_overwrites: options.overwrites?.map((overwrite) => {
|
permission_overwrites: options.permissionOverwrites?.map((overwrite) => {
|
||||||
return {
|
return {
|
||||||
...overwrite,
|
...overwrite,
|
||||||
allow: calculateBits(overwrite.allow),
|
allow: calculateBits(overwrite.allow),
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export async function editChannelOverwrite(
|
|||||||
channelId: string,
|
channelId: string,
|
||||||
overwriteId: string,
|
overwriteId: string,
|
||||||
options: Omit<Overwrite, "id">,
|
options: Omit<Overwrite, "id">,
|
||||||
) {
|
): Promise<undefined> {
|
||||||
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
|
||||||
|
|
||||||
const result = await rest.runMethod(
|
const result = await rest.runMethod(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import { botHasChannelPermissions } from "../../util/permissions.ts";
|
|||||||
* However, if a bot is responding to a command and expects the computation to take a few seconds,
|
* However, if a bot is responding to a command and expects the computation to take a few seconds,
|
||||||
* this endpoint may be called to let the user know that the bot is processing their message.
|
* this endpoint may be called to let the user know that the bot is processing their message.
|
||||||
*/
|
*/
|
||||||
export async function startTyping(channelId: string) {
|
export async function startTyping(channelId: string): Promise<undefined> {
|
||||||
const channel = await cacheHandlers.get("channels", channelId);
|
const channel = await cacheHandlers.get("channels", channelId);
|
||||||
// If the channel is cached, we can do extra checks/safety
|
// If the channel is cached, we can do extra checks/safety
|
||||||
if (channel) {
|
if (channel) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { endpoints } from "../../util/constants.ts";
|
|||||||
export async function swapChannels(
|
export async function swapChannels(
|
||||||
guildId: string,
|
guildId: string,
|
||||||
channelPositions: ModifyGuildChannelPositions[],
|
channelPositions: ModifyGuildChannelPositions[],
|
||||||
) {
|
): Promise<undefined> {
|
||||||
if (channelPositions.length < 2) {
|
if (channelPositions.length < 2) {
|
||||||
throw "You must provide at least two channels to be swapped.";
|
throw "You must provide at least two channels to be swapped.";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user