-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathsendDM.ts
More file actions
42 lines (40 loc) · 1.16 KB
/
sendDM.ts
File metadata and controls
42 lines (40 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* SPDX-License-Identifier: LGPL-3.0-or-later
* Copyright © 2026 BotForge
*/
import { Message } from "discord.js"
import { ArgType, NativeFunction, Return } from "../../structures"
export default new NativeFunction({
name: "$sendDM",
version: "1.0.0",
description: "Sends a dm to the user",
unwrap: true,
brackets: true,
output: ArgType.Message,
args: [
{
name: "user ID",
description: "The user to dm",
rest: false,
type: ArgType.User,
required: true,
},
{
name: "content",
description: "The content to send",
rest: false,
type: ArgType.String,
},
{
name: "return message ID",
description: "Returns the message id of the newly created message",
rest: false,
type: ArgType.Boolean,
},
],
async execute(ctx, [user, content, returnMessageID]) {
ctx.container.content = content || undefined
const msg = await ctx.container.send<Message<true>>(user)
return this.success(returnMessageID ? msg?.id : undefined)
},
})