let prefix = '!';
let currencySymbol = '@';
discordBot.on('message', (msg) => {
let [ command, ...args ] = msg.content.split(' ');
switch(true) {
case(command === `{ $prefix }set-prefix`):
prefix = args[0] ?? prefix;
break;
case(command === `{ $prefix }set-currency`):
currencySymbol = args[0] ?? currencySymbol;
break;
default: break;
};
});
let prefix = '!';
let currencySymbol = '@';
discordBot.on('message', (msg) => {
let [ command, ...args ] = msg.content.split(' ');
switch(true) {
case(command === `{ $prefix }set-prefix`):
prefix = args[0] ?? prefix;
break;
case(command === `{ $prefix }set-currency`):
currencySymbol = args[0] ?? currencySymbol;
break;
default: break;
};
});
Hook.send('<@!477815449195642891>', {
embeds: [
{
color: '#fc0303',
title: `Some title`,
description: `Some description`,
url: `http://some.url/`,
thumbnail: {
url: `http://right-image-preview.com/1.png`,
},
image: {
url: `http://full-image.com/2.png`,
},
fields: [
{
name: `Field 1`,
value: `Field 1 text`,
inline: true,
},
{
name: `Field 2`,
value: `Field 2 text`,
inline: true,
},
]
},
],
}).then(m => '').catch((e) => '');
const fs = require('fs');
const IMG_DIR_PATH = './images/'
const imgArr = fs.readdirSync(IMG_DIR_PATH);
function randomImage() {
let randomIndex = Math.floor(Math.random() * imgArr.length);
let imgFileName = imgArr[randomIndex];
return IMG_DIR_PATH + imgFileName;
};
client.on('message', message => {
let images = [
{ files: [randomImage()] },
];
});