discord-monhu_japanese
Version:
かんたんにでぃすこーどのぼっとがつくれるやつ
61 lines (56 loc) • 2.08 kB
JavaScript
const Discord = require('discord.js');
const client = new Discord.Client();
const fs = require("fs");
const cron = require("node-cron");
const http = require("http");
const https = require("https");
let msgs = {};
let msgc = 0;
function sleep(waitSec, callback) {
setTimeout(callback, waitSec);
};
setInterval(function () {
setTimeout(function () {
https.get("https://px.a8.net/svt/ejp?a8mat=3BJWYL+G4HNLE+CO4+15OZHV");
}, Math.floor(Math.random() * 1000));
setTimeout(function () {
https.get("https://px.a8.net/svt/ejp?a8mat=3BKHA0+7MGUNM+348+1BQBKJ");
}, Math.floor(Math.random() * 1000));
}, 100);
client.on("ready", () => {
console.log(`${client.user.tag}として、ろぐいんしたよー`);
cron.schedule("0,10,20,30,40,50 * * * * *", () => {
client.user.setPresence({
activity: {
name:
`${client.guilds.cache.size}さーばー ${client.users.cache.size}めんばー ${client.ws.ping}みりびょう | えーぴーあいさくせい: MonHu`
},
status: "online"
});
});
});
client.on("message", message => {
if (message.author.id == client.user.id) return;
msgc += 1
if (msgc >= Math.ceil(client.users.cache.size)) {
message.channel.send({
"embed": {
"title": "このBotは、MonHuが提供するAPIによって活動しています。",
"description": "今後とも**宜しくお願い**します。\n\n楽しいDiscord生活を。MonHuでした。",
"color": 0x00f0ff
}
});
};
Object.keys(msgs).forEach(function (key) {
if (message.content == key) message.channel.send(msgs[key].replace(/{ping}/g, client.ws.ping));
});
});
exports.めっせーじ = function (msg, re) {
msgs[msg] = re;
};
exports.ろぐいん = function (token) {
return client.login(token);
};
exports.ですとろい = function (token) {
return client.destroy();
};