mirror of
https://github.com/danbulant/Shasha
synced 2026-06-09 01:20:58 +00:00
trySend update
This commit is contained in:
parent
0c36b96040
commit
30082e91db
1 changed files with 7 additions and 3 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { MessageEmbed, Message, GuildMember, User, Client, GuildChannel, Role, MessageOptions } = require('discord.js');
|
const { MessageEmbed, Message, GuildMember, User, Client, GuildChannel, Role, MessageOptions, Channel } = require('discord.js');
|
||||||
const { defaultErrorLogChannel } = require("../config.json");
|
const { defaultErrorLogChannel } = require("../config.json");
|
||||||
const { database } = require("../database/mongo");
|
const { database } = require("../database/mongo");
|
||||||
const getColor = require('./getColor');
|
const getColor = require('./getColor');
|
||||||
|
|
@ -203,7 +203,7 @@ function noPerm(msg) {
|
||||||
/**
|
/**
|
||||||
* Send message
|
* Send message
|
||||||
* @param {Client} client - (this.client)
|
* @param {Client} client - (this.client)
|
||||||
* @param {Message | String} msg Message object | channel_ID
|
* @param {Message | String | Channel} msg Message object | channel_ID
|
||||||
* @param {MessageOptions} content - ({content:content,optionblabla})
|
* @param {MessageOptions} content - ({content:content,optionblabla})
|
||||||
* @returns {Promise<Message>} Sent message object
|
* @returns {Promise<Message>} Sent message object
|
||||||
*/
|
*/
|
||||||
|
|
@ -213,7 +213,11 @@ async function trySend(client, msg, content) {
|
||||||
if (msg?.channel) {
|
if (msg?.channel) {
|
||||||
msgOf = msg.channel;
|
msgOf = msg.channel;
|
||||||
} else {
|
} else {
|
||||||
msgOf = client.channels.cache.get(msg);
|
if (typeof msg === "string") {
|
||||||
|
msgOf = client.channels.cache.get(msg);
|
||||||
|
} else {
|
||||||
|
msgOf = msg;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
const sentMes = await msgOf.send(content)
|
const sentMes = await msgOf.send(content)
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue