fjuniier
This commit is contained in:
15
index.js
15
index.js
@@ -24,6 +24,7 @@ client.once(Events.ClientReady, readyClient => {
|
|||||||
client.login(token);
|
client.login(token);
|
||||||
|
|
||||||
let peopleWhoCanFunnyEval = ['230659159450845195', '297983197990354944']
|
let peopleWhoCanFunnyEval = ['230659159450845195', '297983197990354944']
|
||||||
|
|
||||||
client.on(Events.MessageCreate, message => {
|
client.on(Events.MessageCreate, message => {
|
||||||
// if we smell a twitter link, girlcock it!
|
// if we smell a twitter link, girlcock it!
|
||||||
const regexProfile = /https?:\/\/x\.com\/(.*?)\/status\/(\d+)/;
|
const regexProfile = /https?:\/\/x\.com\/(.*?)\/status\/(\d+)/;
|
||||||
@@ -43,13 +44,20 @@ client.on(Events.MessageCreate, message => {
|
|||||||
|
|
||||||
// hehe an eval :3 yeah im hardcoding myself
|
// hehe an eval :3 yeah im hardcoding myself
|
||||||
if (message.content.startsWith('!eval') && peopleWhoCanFunnyEval.includes(message.author.id)) {
|
if (message.content.startsWith('!eval') && peopleWhoCanFunnyEval.includes(message.author.id)) {
|
||||||
const code = message.content.slice(6);
|
let code = message.content.substring('!eval'.length).trim();
|
||||||
|
|
||||||
|
// yeah a machine may have wrote this part
|
||||||
|
const codeBlockRegex = /```(?:js)?\n?([\s\S]+)```/;
|
||||||
|
const match = code.match(codeBlockRegex);
|
||||||
|
|
||||||
|
if (match) {
|
||||||
|
code = match[1];
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
eval(code);
|
eval(code);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
//const response = err.toString();
|
|
||||||
//message.channel.send(response);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,4 +95,3 @@ client.on(Events.MessageReactionAdd, (reaction, user) => {
|
|||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user