diff --git a/bot.py b/bot.py index 2472bab..da3bfd9 100644 --- a/bot.py +++ b/bot.py @@ -1,8 +1,9 @@ import sys def process_message(message): - # Replace this with your actual processing logic - return f"Processed message: {message}" + base_message = f"Processed message: {message}" + extra_chars = 'a' * (4000 - len(base_message)) + return base_message + extra_chars if __name__ == "__main__": if len(sys.argv) > 1: diff --git a/events/messageCreate.js b/events/messageCreate.js index 31254ac..631515c 100644 --- a/events/messageCreate.js +++ b/events/messageCreate.js @@ -37,15 +37,36 @@ module.exports = { return message.reply("There was an error processing your request."); } - // Log the output from the Python script - logAction(`GPT: ${stdout.trim()}`, message.author.id, message.author.tag); + let output = stdout.trim(); - // Reply with the output from the Python script - message.reply(stdout.trim()); + // Log the output from the Python script + logAction(`GPT: ${output}`, message.author.id, message.author.tag); + + // Function to split the output into chunks of 2000 characters + function splitMessage(message, maxLength) { + const parts = []; + while (message.length > 0) { + if (message.length > maxLength) { + parts.push(message.slice(0, maxLength)); + message = message.slice(maxLength); + } else { + parts.push(message); + message = ''; + } + } + return parts; + } + + // Split the output if it's longer than 2000 characters + const maxMessageLength = 2000; + const messageParts = splitMessage(output, maxMessageLength); + + // Send each part as a separate message + messageParts.forEach(part => message.reply(part)); }); } else { message.reply("Not whitelisted"); } } }, -}; +} \ No newline at end of file