Prettified Code!

This commit is contained in:
itohatweb
2021-05-21 15:55:49 +00:00
committed by GitHub Action
parent 71a20fb0f4
commit 179add27c9
271 changed files with 889 additions and 3067 deletions
+5 -14
View File
@@ -7,23 +7,14 @@ import { endpoints } from "../../util/constants.ts";
import { sendMessage } from "../messages/send_message.ts";
/** Send a message to a users DM. Note: this takes 2 API calls. 1 is to fetch the users dm channel. 2 is to send a message to that channel. */
export async function sendDirectMessage(
memberId: bigint,
content: string | CreateMessage
) {
export async function sendDirectMessage(memberId: bigint, content: string | CreateMessage) {
let dmChannel = await cacheHandlers.get("channels", memberId);
if (!dmChannel) {
// If not available in cache create a new one.
const dmChannelData = await rest.runMethod<Channel>(
"post",
endpoints.USER_DM,
{
recipient_id: memberId,
}
);
const discordenoChannel = await structures.createDiscordenoChannel(
dmChannelData
);
const dmChannelData = await rest.runMethod<Channel>("post", endpoints.USER_DM, {
recipient_id: memberId,
});
const discordenoChannel = await structures.createDiscordenoChannel(dmChannelData);
// Recreate the channel and add it undert he users id
await cacheHandlers.set("channels", memberId, discordenoChannel);
dmChannel = discordenoChannel;