mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 16:57:22 +00:00
Fix params
This commit is contained in:
@@ -2,7 +2,7 @@ import { Bot } from "../../bot.ts";
|
||||
|
||||
/** Create a reaction for the message. Reaction takes the form of **name:id** for custom guild emoji, or Unicode characters. Requires READ_MESSAGE_HISTORY and ADD_REACTIONS */
|
||||
export async function addReaction(bot: Bot, channelId: bigint, messageId: bigint, reaction: string) {
|
||||
await bot.utils.requireBotChannelPermissions(channelId, ["ADD_REACTIONS", "READ_MESSAGE_HISTORY"]);
|
||||
await bot.utils.requireBotChannelPermissions(bot, channelId, ["ADD_REACTIONS", "READ_MESSAGE_HISTORY"]);
|
||||
|
||||
if (reaction.startsWith("<:")) {
|
||||
reaction = reaction.substring(2, reaction.length - 1);
|
||||
|
||||
@@ -7,7 +7,7 @@ export async function deleteMessage(bot: Bot, channelId: bigint, messageId: bigi
|
||||
const message = await cacheHandlers.get("messages", messageId);
|
||||
|
||||
if (message && message.authorId !== bot.id) {
|
||||
await bot.utils.requireBotChannelPermissions(message.channelId, ["MANAGE_MESSAGES"]);
|
||||
await bot.utils.requireBotChannelPermissions(bot, message.channelId, ["MANAGE_MESSAGES"]);
|
||||
}
|
||||
|
||||
if (delayMilliseconds) await delay(delayMilliseconds);
|
||||
|
||||
@@ -2,7 +2,7 @@ import { Bot } from "../../bot.ts";
|
||||
|
||||
/** Delete messages from the channel. 2-100. Requires the MANAGE_MESSAGES permission */
|
||||
export async function deleteMessages(bot: Bot, channelId: bigint, ids: bigint[], reason?: string) {
|
||||
await bot.utils.requireBotChannelPermissions(channelId, ["MANAGE_MESSAGES"]);
|
||||
await bot.utils.requireBotChannelPermissions(bot, channelId, ["MANAGE_MESSAGES"]);
|
||||
|
||||
if (ids.length < 2) {
|
||||
throw new Error(bot.constants.Errors.DELETE_MESSAGES_MIN);
|
||||
|
||||
@@ -16,7 +16,7 @@ export async function editMessage(bot: Bot, channelId: bigint, messageId: bigint
|
||||
}
|
||||
const requiredPerms: PermissionStrings[] = ["SEND_MESSAGES"];
|
||||
|
||||
await bot.utils.requireBotChannelPermissions(message.channelId, requiredPerms);
|
||||
await bot.utils.requireBotChannelPermissions(bot, message.channelId, requiredPerms);
|
||||
}
|
||||
|
||||
if (typeof content === "string") content = { content };
|
||||
|
||||
@@ -6,7 +6,7 @@ import {SnakeCasedPropertiesDeep} from "../../types/util.ts";
|
||||
/** Fetch a single message from the server. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY */
|
||||
export async function getMessage(bot: Bot, channelId: bigint, id: bigint) {
|
||||
if (await cacheHandlers.has("channels", channelId)) {
|
||||
await bot.utils.requireBotChannelPermissions(channelId, ["VIEW_CHANNEL", "READ_MESSAGE_HISTORY"]);
|
||||
await bot.utils.requireBotChannelPermissions(bot, channelId, ["VIEW_CHANNEL", "READ_MESSAGE_HISTORY"]);
|
||||
}
|
||||
|
||||
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Message>>(bot.rest,"get", bot.constants.endpoints.CHANNEL_MESSAGE(channelId, id));
|
||||
|
||||
Reference in New Issue
Block a user