Skip to content

Commit 33fb0c8

Browse files
committed
Send DMs instead of sending in general channel
1 parent f4add20 commit 33fb0c8

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

dist/main.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@ const Canister = new discord_js_1.Client();
1414
Canister.on("ready", () => {
1515
console.log("I am ready!");
1616
});
17-
Canister.on("guildMemberAdd", (newUser) => {
18-
const channel = newUser.guild.channels.find("name", "general");
19-
console.log(channel.name);
17+
Canister.on("guildMemberAdd", (newUser) => __awaiter(this, void 0, void 0, function* () {
18+
const channel = yield newUser.createDM();
2019
if (!channel) {
2120
return;
2221
}
@@ -42,7 +41,7 @@ Canister.on("guildMemberAdd", (newUser) => {
4241
// Ask for help in respective channels! Participate in the community and most of all, learn and have fun!
4342
// `);
4443
channel.send(welcomeMessage);
45-
});
44+
}));
4645
Canister.on("message", (message) => __awaiter(this, void 0, void 0, function* () {
4746
const pollMatch = message.content.match(/!(poll|help)\s+?(.+)/i); // \s+?(\d)
4847
if (pollMatch && pollMatch.index !== -1) {

src/main.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Client, Message, GuildMember, TextChannel, GuildChannel } from "discord.js";
1+
import { Client, Message, GuildMember, TextChannel, GuildChannel, DMChannel } from "discord.js";
22

33
import pollCommand from "./commands/poll";
44

@@ -8,9 +8,8 @@ Canister.on("ready", () => {
88
console.log("I am ready!");
99
});
1010

11-
Canister.on("guildMemberAdd", (newUser: GuildMember) => {
12-
const channel: TextChannel = newUser.guild.channels.find("name", "general") as TextChannel;
13-
console.log(channel.name);
11+
Canister.on("guildMemberAdd", async (newUser: GuildMember) => {
12+
const channel: DMChannel = await newUser.createDM();
1413
if (!channel) {
1514
return;
1615
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy