Fix eval and add "Reply to all users feature"

This commit is contained in:
pixtaded 2024-08-30 17:50:44 +03:00
parent f20ee7690f
commit d26b802b8d

View File

@ -14,7 +14,8 @@ const shapeGuild = config.shapeGuild;
const ALLOWED_CHANNEL_TYPES = ["DM", "GROUP_DM"];
function isAllowedUser(id) {
if (config.ALLOWED_IDS.find(string => string == id)) return true;
const ALLOWED_IDS = config.ALLOWED_IDS;
if (ALLOWED_IDS.find(string => string == id) || !ALLOWED_IDS.length) return true;
return false;
}
@ -55,15 +56,14 @@ async function getMessageContent(message) {
async function sendToAI(message) {
if (message.author.id == client.user.id) return;
if (message.author.id == config.admin && message.content.startsWith("e ")) eval(message.content.substring(1));
savedMessage = message;
client.guilds.cache.get(shapeGuild).channels.cache.get(config.shapeChannel).send(await getMessageContent(message));
}
async function processGuildTextMessage(message) {
if (message.author.id == config.admin && message.content.startsWith("e ")) {
eval(message.content.substring(1));
}
else if (message.guild.id != shapeGuild &&
if (message.guild.id != shapeGuild &&
(message.mentions.users.get(client.user.id) || isAllowedUser(message.author.id) || (!isAllowedUser && count % 5 == 0)
|| (message.reference && message.channel.messages.cache.get(message.reference.messageId).author.id == client.user.id)))
sendToAI(message);
@ -82,4 +82,5 @@ client.on("messageCreate", function(message){
console.error(error);
}
});
client.login(config.token);