fixed being able to crash bot by creating messages over 2k characters
This commit is contained in:
parent
94037a9e4b
commit
8c595a9a01
2 changed files with 5 additions and 4 deletions
|
@ -19,6 +19,7 @@ clean up p/vileimagery, its horrendous
|
||||||
|
|
||||||
1.12 - changed most discord actions to be handled by 1 script. this should cut down on errors and allow you to actually use the bot in other servers (i think)
|
1.12 - changed most discord actions to be handled by 1 script. this should cut down on errors and allow you to actually use the bot in other servers (i think)
|
||||||
1.12.1 - direct messages are now redirected to main channel
|
1.12.1 - direct messages are now redirected to main channel
|
||||||
|
1.12.2 - fixed being able to crash bot by creating messages over 2k characters
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ const client = index.client;
|
||||||
|
|
||||||
export async function sendMainMessage(message) {
|
export async function sendMainMessage(message) {
|
||||||
const channel = client.channels.cache.get("1148814162273763418");
|
const channel = client.channels.cache.get("1148814162273763418");
|
||||||
const msg = await channel.send(message);
|
const msg = await channel.send(message.slice(0, 2000));
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ export function sendError(message) {
|
||||||
const channel = client.channels.cache.get("1148814162273763418");
|
const channel = client.channels.cache.get("1148814162273763418");
|
||||||
let msg;
|
let msg;
|
||||||
try {
|
try {
|
||||||
msg = channel.send(`**error:** ${message}`);
|
msg = channel.send(`**error:** ${message.slice(0, 1750)}`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.log(err);
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -45,7 +45,7 @@ export function sendMessage(channelId, message) {
|
||||||
let msg;
|
let msg;
|
||||||
if (channel) {
|
if (channel) {
|
||||||
try {
|
try {
|
||||||
msg = await channel.send(message);
|
msg = await channel.send(message.slice(0, 2000));
|
||||||
return msg;
|
return msg;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
sendError(err.slice(err.length - 1750, err.length));
|
sendError(err.slice(err.length - 1750, err.length));
|
||||||
|
@ -61,7 +61,7 @@ export function sendMessage(channelId, message) {
|
||||||
export function reply(triggerMessage, message) {
|
export function reply(triggerMessage, message) {
|
||||||
try {
|
try {
|
||||||
(async () => {
|
(async () => {
|
||||||
let msg = await triggerMessage.reply(message);
|
let msg = await triggerMessage.reply(message.slice(0, 2000));
|
||||||
return msg;
|
return msg;
|
||||||
})();
|
})();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue