fmt files damn son

This commit is contained in:
ayntee
2021-04-12 23:13:37 +04:00
parent fb42d03944
commit 1cbc1b8f82
45 changed files with 443 additions and 281 deletions
+2 -2
View File
@@ -9,7 +9,7 @@ import { requireBotChannelPermissions } from "../../util/permissions.ts";
/** Edit the message. */
export async function editMessage(
message: Message,
content: string | MessageContent
content: string | MessageContent,
) {
if (message.author.id !== botId) {
throw "You can only edit a message that was sent by the bot.";
@@ -30,7 +30,7 @@ export async function editMessage(
const result = await rest.runMethod(
"patch",
endpoints.CHANNEL_MESSAGE(message.channelId, message.id),
content
content,
);
return structures.createDiscordenoMessage(result as DiscordMessage);
+1 -1
View File
@@ -16,7 +16,7 @@ export async function getMessage(channelId: string, id: string) {
const result = (await rest.runMethod(
"get",
endpoints.CHANNEL_MESSAGE(channelId, id)
endpoints.CHANNEL_MESSAGE(channelId, id),
)) as DiscordMessage;
return structures.createDiscordenoMessage(result);
+1 -1
View File
@@ -7,7 +7,7 @@ import { endpoints } from "../../util/constants.ts";
export async function publishMessage(channelId: string, messageId: string) {
const data = (await rest.runMethod(
"post",
endpoints.CHANNEL_MESSAGE_CROSSPOST(channelId, messageId)
endpoints.CHANNEL_MESSAGE_CROSSPOST(channelId, messageId),
)) as DiscordMessage;
return structures.createDiscordenoMessage(data);
+13 -14
View File
@@ -14,7 +14,7 @@ import { camelKeysToSnakeCase } from "../../util/utils.ts";
/** Send a message to the channel. Requires SEND_MESSAGES permission. */
export async function sendMessage(
channelId: string,
content: string | CreateMessage
content: string | CreateMessage,
) {
if (typeof content === "string") content = { content };
@@ -56,18 +56,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,
);
}
}
@@ -75,18 +75,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,
);
}
}
@@ -99,14 +99,13 @@ export async function sendMessage(
...content,
...(content.messageReference?.messageId
? {
messageReference: {
...content.messageReference,
failIfNotExists:
content.messageReference.failIfNotExists === true,
},
}
messageReference: {
...content.messageReference,
failIfNotExists: content.messageReference.failIfNotExists === true,
},
}
: {}),
})
}),
)) as DiscordMessage;
return structures.createDiscordenoMessage(result);