const ACTIVITY = "In testing"
const API_TOKEN = "";
const Discord = require('discord.js');
const { Client, MessageEmbed } = require('discord.js');
const { RichEmbed } = require('discord.js');
const client = new Discord.Client({ partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });
let coins = require("./coins.json");
let fs = require("fs");
const PREFIX = "!";
client.on('ready', async () => {
console.log(`Logged in as ${client.user.tag}`);
client.user.setStatus('idle');
client.user.setActivity(ACTIVITY, { type: "PLAYING"});
});
client.on('message', async message => {
if(!coins[message.author.id]){
coins[message.author.id] = {
coins: 0
};
}
let coinAmt = Math.floor(Math.random() * 1) + 1;
let baseAmt = Math.floor(Math.random() * 1) + 1;
if(coinAmt === baseAmt){
coins[message.author.id] = {
coins: coins[message.author.id].coins + coinAmt
};
fs.writeFile("./coins.json", JSON.stringify(coins), (err) => {
if (err) console.log(err)
});
}
let uCoins = coins[message.author.id].coins;
let coinEmbed = new MessageEmbed()
.setTitle(message.author.username)
.setColor("#00FF00")
.setDescription("Монеты:" + uCoins);
if(message.content === PREFIX + "coins")
{
message.channel.send(coinEmbed)
}
})
client.login(API_TOKEN);
if
, то, я не думаю, что вам составит труда обрамить в if () место, которое отвечает за выдачу монеток.message.channel.id
if (ID_канала === "0000000") {
return;
} else {
// выдача
}