Merge remote-tracking branch 'origin/fp-attempt-9001' into fp-attempt-9001

This commit is contained in:
TriForMine
2021-10-15 15:17:37 +02:00
2 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -74,7 +74,7 @@ import {
DiscordenoShard,
} from "./ws/mod.ts";
import { validateLength } from "./util/validate_length.ts";
import {delay, validateComponents, validateSlashOptionChoices, validateSlashOptions} from "./util/utils.ts";
import { delay, validateComponents, validateSlashOptionChoices, validateSlashOptions } from "./util/utils.ts";
import { iconBigintToHash, iconHashToBigInt } from "./util/hash.ts";
import { calculateShardId } from "./util/calculate_shard_id.ts";
@@ -284,7 +284,7 @@ export function createUtils(options: Partial<HelperUtils>) {
validateSlashOptions,
validateSlashOptionChoices,
requireBotChannelPermissions,
validateComponents
validateComponents,
};
}
+7 -2
View File
@@ -6,7 +6,7 @@ import type {
} from "../../types/messages/get_messages.ts";
import type { Message } from "../../types/messages/message.ts";
import type { Bot } from "../../bot.ts";
import type {SnakeCasedPropertiesDeep} from "../../types/util.ts";
import type { SnakeCasedPropertiesDeep } from "../../types/util.ts";
/** Fetches between 2-100 messages. Requires VIEW_CHANNEL and READ_MESSAGE_HISTORY */
export async function getMessages(
@@ -20,7 +20,12 @@ export async function getMessages(
throw new Error(bot.constants.Errors.INVALID_GET_MESSAGES_LIMIT);
}
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Message>[]>(bot.rest, "get", bot.constants.endpoints.CHANNEL_MESSAGES(channelId), options);
const result = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Message>[]>(
bot.rest,
"get",
bot.constants.endpoints.CHANNEL_MESSAGES(channelId),
options
);
return await Promise.all(result.map((res) => bot.transformers.message(bot, res)));
}