fixed bug welcomeCommand
This commit is contained in:
parent
62b3eb070b
commit
b8365abce8
@ -36,24 +36,29 @@ export class DmService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async forward(message: OmitPartialGroupDMChannel<Message<boolean>>) {
|
async forward(message: OmitPartialGroupDMChannel<Message<boolean>>) {
|
||||||
console.log("forward message");
|
if (message.channel.isDMBased()) {
|
||||||
|
const author = message.author.id;
|
||||||
|
const recipient = message.channel.recipient?.id;
|
||||||
|
console.log("forward message");
|
||||||
|
let context = "";
|
||||||
|
|
||||||
const context = `<@${message.author.id}> hat geschrieben: " ${message.content} "`;
|
if (message.author.bot) {
|
||||||
|
context = `<@${author}> hat an <@${recipient}> geschrieben:\n"${message.content}"`;
|
||||||
console.log(context);
|
}
|
||||||
|
else {
|
||||||
try {
|
context = `<@${author}> hat geschrieben:\n"${message.content}"`;
|
||||||
const channels = client.channels;
|
|
||||||
const channel = channels.cache.get(config.discord.channelIdNotification);
|
|
||||||
|
|
||||||
if (channel?.isTextBased() && channel?.isSendable()) {
|
|
||||||
await channel.send(context);
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error("error while forwarding a welcome msg:", error);
|
|
||||||
}
|
|
||||||
|
|
||||||
//client.users.send(config.discord.myId, context);
|
try {
|
||||||
|
const channels = client.channels;
|
||||||
|
const channel = channels.cache.get(config.discord.channelIdNotification);
|
||||||
|
if (channel?.isTextBased() && channel?.isSendable()) {
|
||||||
|
await channel.send(context);
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
console.error("error while forwarding a msg:", error);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async acceptDm(member: GuildMember) {
|
async acceptDm(member: GuildMember) {
|
||||||
|
@ -247,11 +247,14 @@ export class GreetingService {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const channels = client.channels;
|
const channels = client.channels;
|
||||||
const channel = channels.cache.get(config.discord.channelIdWelcome);
|
const channel = channels.cache.get(config.discord.channelIdBot);
|
||||||
|
|
||||||
if (channel?.isTextBased() && channel?.isSendable()) {
|
if (channel?.isTextBased() && channel?.isSendable()) {
|
||||||
await channel.send(welcomeContent);
|
await channel.send(welcomeContent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await this.dmService.welcomePrivate(member);
|
||||||
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("error while sending a welcome command msg:", error);
|
console.error("error while sending a welcome command msg:", error);
|
||||||
}
|
}
|
||||||
|
@ -54,7 +54,6 @@ export default class DiscordController extends EventEmitter {
|
|||||||
client.on("messageCreate", async (message) => {
|
client.on("messageCreate", async (message) => {
|
||||||
console.log(message.id)
|
console.log(message.id)
|
||||||
if (message.channel.type === ChannelType.DM
|
if (message.channel.type === ChannelType.DM
|
||||||
&& message.author.id !== config.discord.botId
|
|
||||||
) {
|
) {
|
||||||
console.log("got msg");
|
console.log("got msg");
|
||||||
this.dmService.forward(message);
|
this.dmService.forward(message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user