const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");
module.exports.run = async (bot, message, args) => {
if(!message.content.startsWith('!'))return;
let user = message.author;
let timeout = 86400000;
function random(min, max) {
let rand = min - 0.5 + Math.random() * (max - min + 1);
return Math.round(rand);
}
let daily = await db.fetch(`daily_${message.guild.id}_${user.id}`);
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
let timeEmbed = new Discord.MessageEmbed()
.setAuthor(`Daily`, message.author.displayAvatarURL)
.setColor("GREEN")
.setDescription(`Вы уже забрали свою ежедневную награду, забери награду снова через ${time.hours}ч ${time.minutes}м ${time.seconds}с `);
message.channel.send(timeEmbed)
} else {
let moneyEmbed = new Discord.MessageEmbed()
.setColor("GREEN")
.setDescription(`Вы получили ежедневную награду в размере ${amount} коинов`);
message.channel.send(`Случайное число: ${random(100, 500)}`)
message.channel.send(moneyEmbed)
db.add(`money_${message.guild.id}_${user.id}`, amount)
db.set(`daily_${message.guild.id}_${user.id}`, Date.now())
}
};
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");
module.exports.run = async (bot, message, args) => {
if(!message.content.startsWith('!'))return;
let user = message.author;
let timeout = 86400000;
function random(min, max) {
let rand = min - 0.5 + Math.random() * (max - min + 1);
return Math.round(rand);
}
let daily = await db.fetch(`daily_${message.guild.id}_${user.id}`);
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
let timeEmbed = new Discord.MessageEmbed()
.setAuthor(`Daily`, message.author.displayAvatarURL)
.setColor("GREEN")
.setDescription(`Вы уже забрали свою ежедневную награду, забери награду снова через ${time.hours}ч ${time.minutes}м ${time.seconds}с `);
message.channel.send(timeEmbed)
} else {
let moneyEmbed = new Discord.MessageEmbed()
.setColor("GREEN")
.setDescription(`Вы получили ежедневную награду в размере ${amount} коинов`);
message.channel.send(moneyEmbed)
db.add(`money_${message.guild.id}_${user.id}`, amount)
db.set(`daily_${message.guild.id}_${user.id}`, Date.now())
}
};
const Discord = require("discord.js");
const db = require("quick.db");
const ms = require("parse-ms");
module.exports.run = async (bot, message, args) => {
if(!message.content.startsWith('!'))return;
let user = message.author;
let timeout = 86400000;
function random(min, max) {
let rand = min - 0.5 + Math.random() * (max - min + 1);
return Math.round(rand);
}
let daily = await db.fetch(`daily_${message.guild.id}_${user.id}`);
if (daily !== null && timeout - (Date.now() - daily) > 0) {
let time = ms(timeout - (Date.now() - daily));
let timeEmbed = new Discord.MessageEmbed()
.setAuthor(`Daily`, message.author.displayAvatarURL)
.setColor("GREEN")
.setDescription(`Вы уже забрали свою ежедневную награду, забери награду снова через ${time.hours}ч ${time.minutes}м ${time.seconds}с `);
message.channel.send(timeEmbed)
} else {
let moneyEmbed = new Discord.MessageEmbed()
.setColor("GREEN")
.setDescription(`Вы получили ежедневную награду в размере ${amount} коинов`);
message.channel.send(moneyEmbed)
db.add(`money_${message.guild.id}_${user.id}`, amount)
db.set(`daily_${message.guild.id}_${user.id}`, Date.now())
}
};
const Discord = require('discord.js');
const bot = new Discord.Client();
let config = require('./botconfig.json');
let client = config.client;
let token = config.token;
let prefix = config.prefix;
bot.on('ready', () => {
console.log(`Запустился бот ${bot.user.username}`);
bot.generateInvite(["ADMINISTRATOR"]).then(link => {
console.log(link);
});
});
bot.user.setPresence({
game: {
name: 'Стримит',
type: "STREAMING",
url: "https://www.twitch.tv/evilarthas"
}
});
bot.on('message', msg => {
if (msg.content === prefix + 'ping') {
msg.reply('pong');
}
});
bot.login(token);