mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 11:28:15 +00:00
change: prettier code
This commit is contained in:
committed by
GitHub Action
parent
fe22c5ea73
commit
9a1f8f41a5
@@ -1,7 +1,7 @@
|
||||
import type { Channel } from "../../types/channels/channel.ts";
|
||||
import type { CreateMessage } from "../../types/messages/create_message.ts";
|
||||
import type {Bot} from "../../bot.ts";
|
||||
import type {SnakeCasedPropertiesDeep} from "../../types/util.ts";
|
||||
import type { Bot } from "../../bot.ts";
|
||||
import type { SnakeCasedPropertiesDeep } from "../../types/util.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(bot: Bot, memberId: bigint, content: string | CreateMessage) {
|
||||
@@ -10,9 +10,14 @@ export async function sendDirectMessage(bot: Bot, memberId: bigint, content: str
|
||||
let dmChannel = await bot.cache.channels.get(memberId);
|
||||
if (!dmChannel) {
|
||||
// If not available in cache create a new one.
|
||||
const dmChannelData = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Channel>>(bot.rest,"post", bot.constants.endpoints.USER_DM, {
|
||||
recipient_id: memberId,
|
||||
});
|
||||
const dmChannelData = await bot.rest.runMethod<SnakeCasedPropertiesDeep<Channel>>(
|
||||
bot.rest,
|
||||
"post",
|
||||
bot.constants.endpoints.USER_DM,
|
||||
{
|
||||
recipient_id: memberId,
|
||||
}
|
||||
);
|
||||
const discordenoChannel = await bot.transformers.channel(bot, dmChannelData);
|
||||
// Recreate the channel and add it under the users id
|
||||
await bot.cache.channels.set(memberId, discordenoChannel);
|
||||
|
||||
Reference in New Issue
Block a user