Fix params

This commit is contained in:
TriForMine
2021-10-15 15:00:35 +02:00
parent 9e664bfcbe
commit 8acc8b9a6b
5 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -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 };
+1 -1
View File
@@ -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));