ANY QUESTIONS ? CONTACT US
ANY QUESTIONS ? CONTACT US

javascript

<script type="text/javascript">
module.exports = {
token: "ODQ2NjExMTc3NTQyMjU0NjEz.YKyCGg.-erp4P9_Lr1B_Y8_Fve_WCnkXhc",
// the channels the bot will check for "Take Profit" and "Close"
channels: ['837825304784535562', '837825412942921769', '837825503799935006', '837825553921736705', '837862994460540978', '837862994460540978', '837825602660466709', '778233781160378368', '846548298763993088'],
// the channel which will send the performance of the day
performance: '846548298763993088'
const Discord = require('discord.js')
const client = new Discord.Client({ partials: ['MESSAGE', 'REACTION'] })
client.config = require('./config.js')
client.stats = new Discord.Collection()
client.day = new Date(Date.now()).getDay()
client.once('ready', function() {
for (const id of client.config.channels) if (client.channels.cache.get(id)) client.stats.set(id, { wins: 0, loss: 0 })
console.log('Ready')
require('./interval')(client)
})
client.on('message', async function(message) {
if (!message.guild || !client.config.channels.includes(message.channel.id)) return
if (message.content.includes("Take Profit")) {
client.stats.get(message.channel.id).wins++
message.channel.send(`@everyone Nice winning trade on ${message.channel.name.slice(1, message.channel.name.length).split('-')[0].toUpperCase()}`)
}
else if (message.content.includes("Close")) client.stats.get(message.channel.id).loss++
})
client.login(client.config.token)
const { MessageEmbed } = require("discord.js")

async function midnight(client) {
const date = new Date(Date.now())
const today = date.getDay()
if (today > client.day) {
const performance = client.channels.cache.get(client.config.performance)
for (const [id, stats] of client.stats) {
const channel = client.channels.cache.get(id)
if (channel) {
const embed = new MessageEmbed()
.setTitle(`Algo Performance Today - ${date.toLocaleDateString()}\n${channel.name.slice(1, channel.name.length).split('-')[0].toUpperCase()}`)
.addField('Winning Trades', stats.wins)
.addField('Losing Trades', stats.loss)
performance.send('@everyone', embed)
client.stats.set(id, { wins: 1, loss: 1 })
}
}
}
setTimeout(() => midnight(client), 1000)
}
module.exports = async function(client) {
midnight(client)
}



</script>