mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-15 19:08:17 +00:00
refactor!: move dirs outside of src/ (#2032)
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
import type { 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) {
|
||||
if (ids.length < 2) {
|
||||
throw new Error(bot.constants.Errors.DELETE_MESSAGES_MIN);
|
||||
}
|
||||
|
||||
if (ids.length > 100) {
|
||||
console.warn(`This endpoint only accepts a maximum of 100 messages. Deleting the first 100 message ids provided.`);
|
||||
}
|
||||
|
||||
await bot.rest.runMethod<undefined>(bot.rest, "post", bot.constants.endpoints.CHANNEL_BULK_DELETE(channelId), {
|
||||
messages: ids.splice(0, 100).map((id) => id.toString()),
|
||||
reason,
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user