Fix eval and add "Reply to all users feature"
This commit is contained in:
parent
f20ee7690f
commit
d26b802b8d
11
index.js
11
index.js
@ -14,7 +14,8 @@ const shapeGuild = config.shapeGuild;
|
|||||||
const ALLOWED_CHANNEL_TYPES = ["DM", "GROUP_DM"];
|
const ALLOWED_CHANNEL_TYPES = ["DM", "GROUP_DM"];
|
||||||
|
|
||||||
function isAllowedUser(id) {
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,15 +56,14 @@ async function getMessageContent(message) {
|
|||||||
|
|
||||||
async function sendToAI(message) {
|
async function sendToAI(message) {
|
||||||
if (message.author.id == client.user.id) return;
|
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;
|
savedMessage = message;
|
||||||
client.guilds.cache.get(shapeGuild).channels.cache.get(config.shapeChannel).send(await getMessageContent(message));
|
client.guilds.cache.get(shapeGuild).channels.cache.get(config.shapeChannel).send(await getMessageContent(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processGuildTextMessage(message) {
|
async function processGuildTextMessage(message) {
|
||||||
if (message.author.id == config.admin && message.content.startsWith("e ")) {
|
if (message.guild.id != shapeGuild &&
|
||||||
eval(message.content.substring(1));
|
|
||||||
}
|
|
||||||
else if (message.guild.id != shapeGuild &&
|
|
||||||
(message.mentions.users.get(client.user.id) || isAllowedUser(message.author.id) || (!isAllowedUser && count % 5 == 0)
|
(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)))
|
|| (message.reference && message.channel.messages.cache.get(message.reference.messageId).author.id == client.user.id)))
|
||||||
sendToAI(message);
|
sendToAI(message);
|
||||||
@ -82,4 +82,5 @@ client.on("messageCreate", function(message){
|
|||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.login(config.token);
|
client.login(config.token);
|
Loading…
Reference in New Issue
Block a user