Prettified Code!

This commit is contained in:
itohatweb
2021-05-21 15:51:33 +00:00
committed by GitHub Action
parent fe4ab8517b
commit 3549cdeb63
279 changed files with 1617 additions and 1768 deletions
+14 -13
View File
@@ -15,7 +15,7 @@ import { validateLength } from "../../util/validate_length.ts";
/** Send a message to the channel. Requires SEND_MESSAGES permission. */
export async function sendMessage(
channelId: bigint,
content: string | CreateMessage,
content: string | CreateMessage
) {
if (typeof content === "string") content = { content };
@@ -60,18 +60,18 @@ export async function sendMessage(
if (content.allowedMentions.users?.length) {
if (
content.allowedMentions.parse?.includes(
DiscordAllowedMentionsTypes.UserMentions,
DiscordAllowedMentionsTypes.UserMentions
)
) {
content.allowedMentions.parse = content.allowedMentions.parse.filter(
(p) => p !== "users",
(p) => p !== "users"
);
}
if (content.allowedMentions.users.length > 100) {
content.allowedMentions.users = content.allowedMentions.users.slice(
0,
100,
100
);
}
}
@@ -79,18 +79,18 @@ export async function sendMessage(
if (content.allowedMentions.roles?.length) {
if (
content.allowedMentions.parse?.includes(
DiscordAllowedMentionsTypes.RoleMentions,
DiscordAllowedMentionsTypes.RoleMentions
)
) {
content.allowedMentions.parse = content.allowedMentions.parse.filter(
(p) => p !== "roles",
(p) => p !== "roles"
);
}
if (content.allowedMentions.roles.length > 100) {
content.allowedMentions.roles = content.allowedMentions.roles.slice(
0,
100,
100
);
}
}
@@ -107,13 +107,14 @@ export async function sendMessage(
...content,
...(content.messageReference?.messageId
? {
messageReference: {
...content.messageReference,
failIfNotExists: content.messageReference.failIfNotExists === true,
},
}
messageReference: {
...content.messageReference,
failIfNotExists:
content.messageReference.failIfNotExists === true,
},
}
: {}),
}),
})
);
return structures.createDiscordenoMessage(result);