diff --git a/README.md b/README.md index 81e0be3..d745121 100644 --- a/README.md +++ b/README.md @@ -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 --- diff --git a/src/util/discordAction.js b/src/util/discordAction.js index f097651..e9c1c22 100644 --- a/src/util/discordAction.js +++ b/src/util/discordAction.js @@ -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) {