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.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) {
|
||||
const channel = client.channels.cache.get("1148814162273763418");
|
||||
const msg = await channel.send(message);
|
||||
const msg = await channel.send(message.slice(0, 2000));
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ export function sendError(message) {
|
|||
const channel = client.channels.cache.get("1148814162273763418");
|
||||
let msg;
|
||||
try {
|
||||
msg = channel.send(`**error:** ${message}`);
|
||||
msg = channel.send(`**error:** ${message.slice(0, 1750)}`);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
return undefined;
|
||||
|
@ -45,7 +45,7 @@ export function sendMessage(channelId, message) {
|
|||
let msg;
|
||||
if (channel) {
|
||||
try {
|
||||
msg = await channel.send(message);
|
||||
msg = await channel.send(message.slice(0, 2000));
|
||||
return msg;
|
||||
} catch (err) {
|
||||
sendError(err.slice(err.length - 1750, err.length));
|
||||
|
@ -61,7 +61,7 @@ export function sendMessage(channelId, message) {
|
|||
export function reply(triggerMessage, message) {
|
||||
try {
|
||||
(async () => {
|
||||
let msg = await triggerMessage.reply(message);
|
||||
let msg = await triggerMessage.reply(message.slice(0, 2000));
|
||||
return msg;
|
||||
})();
|
||||
} catch (err) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue