BROKEN
This commit is contained in:
parent
44d41405d8
commit
c5ef82daa0
30
index.js
30
index.js
@ -9,7 +9,7 @@ const debug = true;
|
||||
// const config = require('./config.json');
|
||||
const { prefix } = require('./config.json');
|
||||
|
||||
// const owner = process.env.ownerID;
|
||||
// const owner = process.env.ownerID;
|
||||
const giphy = require('giphy-api')(process.env.giphyAPIKey);
|
||||
const functions = require('./functions.js');
|
||||
|
||||
@ -19,18 +19,18 @@ client.once('ready', () => {
|
||||
client.user.setActivity('Nod Simulator 2021', { type: 'PLAYING' }).then().catch(console.error);
|
||||
functions.getCommandFiles(client);
|
||||
functions.getGifFiles(client);
|
||||
functions.getPastaFiles(client);
|
||||
});
|
||||
|
||||
client.login(process.env.TOKEN);
|
||||
|
||||
client.on('message', message => {
|
||||
const ext = functions.extCheck(message.content);
|
||||
if (debug) console.log(ext);
|
||||
if ((!message.content.startsWith(prefix) && ext == false) || message.author.bot) return;
|
||||
const args = message.content.trim().split(/ +/);
|
||||
const extension = functions.getExtension(args);
|
||||
if ((!message.content.startsWith(prefix) && extension != undefined) || message.author.bot) return;
|
||||
|
||||
if (message.content.startsWith(prefix)) {
|
||||
const args = message.content.slice(prefix.length).trim().split(/ +/);
|
||||
const command = args.shift().toLowerCase();
|
||||
const command = args.shift().toLowerCase().slice(prefix.length);
|
||||
|
||||
if (debug) console.log(args);
|
||||
if (!client.commands.has(command)) return;
|
||||
@ -44,8 +44,9 @@ client.on('message', message => {
|
||||
}
|
||||
}
|
||||
|
||||
if (ext == 'gif') {
|
||||
const query = message.content.slice(0, -4);
|
||||
const query = message.content.slice(0, -4);
|
||||
switch (extension) {
|
||||
case '.gif':
|
||||
if (debug) console.log(query);
|
||||
|
||||
if (!client.gifs.has(query)) {
|
||||
@ -60,5 +61,18 @@ client.on('message', message => {
|
||||
} else {
|
||||
message.channel.send(client.gifs.get(query).embed_url);
|
||||
}
|
||||
break;
|
||||
case '.pasta':
|
||||
const pastaName = args[0].splice(args[0].search(/\.(?:.(?!\\))+$/gim))
|
||||
if (debug) console.log(query);
|
||||
|
||||
if (!client.pastas.has(query)) {
|
||||
message.reply('Sorry I couldn\'t find that gif.');
|
||||
} else {
|
||||
message.channel.send(client.pastas.get(query).content);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user