accept user fluxer implementation
This commit is contained in:
@@ -20,11 +20,9 @@ export class MessagesService
|
||||
async sendToUser(userInput: User, message: MessagePayload): Promise<void> {
|
||||
const user = await client.users.fetch(userInput.id);
|
||||
|
||||
if (user) {
|
||||
await user.send(message);
|
||||
} else {
|
||||
this.logger.error(`User with ID ${userInput.id} not found.`);
|
||||
}
|
||||
if (!user) this.logger.error(`User with ID ${userInput.id} not found.`);
|
||||
this.logger.info(`sending message to user with ID ${userInput.id}.`);
|
||||
await user.send(message);
|
||||
}
|
||||
|
||||
async logMessage(message: Message): Promise<void> {
|
||||
@@ -38,7 +36,6 @@ export class MessagesService
|
||||
|
||||
recipient = channel.recipient;
|
||||
}
|
||||
|
||||
let logMessage: string;
|
||||
|
||||
if (recipient) {
|
||||
@@ -57,7 +54,16 @@ export class MessagesService
|
||||
const fetchedChannel = await client.channels.fetch(channel.id);
|
||||
|
||||
if (fetchedChannel?.isTextBased() && fetchedChannel.isSendable()) {
|
||||
await fetchedChannel.send(createMessageInput);
|
||||
this.logger.info(`sending message to channel with ID ${channel.id}.`);
|
||||
const success = await fetchedChannel.send(createMessageInput);
|
||||
if (success)
|
||||
this.logger.info(
|
||||
`sending message to channel with ID ${channel.id} SUCCESS.`,
|
||||
);
|
||||
else
|
||||
this.logger.error(
|
||||
`sending message to channel with ID ${channel.id} FAILED.`,
|
||||
);
|
||||
} else {
|
||||
this.logger.error(
|
||||
`Channel with ID ${channel.id} not found or is not text-based.`,
|
||||
|
||||
Reference in New Issue
Block a user