Bugtesting for 2.0 release
This commit is contained in:
@@ -7,17 +7,17 @@ const Helper = require('../helper.js');
|
||||
|
||||
/*message object, messaage full, message args, discord client*/
|
||||
|
||||
module.exports.addadminrole = async function(message, msg, args, discordclient) {
|
||||
module.exports.addadminrole = function(message, msg, args, discordclient) {
|
||||
|
||||
}
|
||||
|
||||
module.exports.stop = async function(message, msg, args, discordclient) {
|
||||
module.exports.stop = function(message, msg, args, discordclient) {
|
||||
message.channel.send(':white_check_mark: \`Disconnected...\`');
|
||||
Logger.failed('Disconnected');
|
||||
discordclient.destroy();
|
||||
}
|
||||
|
||||
module.exports.reload = async function(message, msg, args, discordclient) {
|
||||
module.exports.reload = function(message, msg, args, discordclient) {
|
||||
try {
|
||||
Config.loadFromFile();
|
||||
message.channel.send(':white_check_mark: \`Configuration reloaded...\`');
|
||||
@@ -26,7 +26,7 @@ module.exports.reload = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.setprefix = async function(message, msg, args, discordclient) {
|
||||
module.exports.setprefix = function(message, msg, args, discordclient) {
|
||||
if (args[1]) {
|
||||
let servers = Config.getservers()
|
||||
servers[message.guild.id].prefix = args[1]
|
||||
@@ -38,7 +38,7 @@ module.exports.setprefix = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.setgame = async function(message, msg, args, discordclient) {
|
||||
module.exports.setgame = function(message, msg, args, discordclient) {
|
||||
if (args[1]) {
|
||||
let newGame = '';
|
||||
for (let i = 1; i < args.length; i++) {
|
||||
@@ -54,7 +54,7 @@ module.exports.setgame = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.dumpRoles = async function(message, msg, args, discordclient) {
|
||||
module.exports.dumpRoles = function(message, msg, args, discordclient) {
|
||||
let output = 'Role name | Role Snowflake ID \n---------------------------------------------------\n'
|
||||
let padding = 22;
|
||||
|
||||
@@ -74,4 +74,35 @@ module.exports.dumpRoles = async function(message, msg, args, discordclient) {
|
||||
});
|
||||
|
||||
message.channel.send('```' + output + '```');
|
||||
}
|
||||
|
||||
module.exports.serverconfig = async function (message, msg, args, discordclient) {
|
||||
if (message.author.id == Config.getconfig().OwnerID) {//bot owners id
|
||||
message.channel.send('Uploading...')
|
||||
|
||||
let atm = new Discord.Attachment();
|
||||
atm.setAttachment('./resources/servers.json', 'Servers.json');
|
||||
|
||||
message.channel.send(atm);
|
||||
|
||||
await Helper.sleep(40);
|
||||
message.channel.fetchMessages({ limit: 10 })
|
||||
.then((_messages) => {
|
||||
let messages = _messages.array();
|
||||
let counter = 0;
|
||||
for (let i = 0; i < messages.length; i++) {
|
||||
if (messages[i].author.id === discordclient.user.id) {
|
||||
if (counter == 0) {
|
||||
counter++;
|
||||
} else {
|
||||
messages[i].delete();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
.catch();
|
||||
} else {
|
||||
message.channel.send(':no_entry_sign: \`You are not authorized to issue this command\`')
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,9 @@ const Helper = require('../helper.js');
|
||||
|
||||
/*message object, messaage full, message args, discord client*/
|
||||
|
||||
module.exports.help = async function(message, msg, args, discordclient) {
|
||||
module.exports.help = function(message, msg, args, discordclient) {
|
||||
let commands = CommandManager.commands;
|
||||
|
||||
if (args[1]) {
|
||||
if (commands[args[1].toLowerCase()]) {
|
||||
let em = new Discord.RichEmbed();
|
||||
@@ -27,15 +28,42 @@ module.exports.help = async function(message, msg, args, discordclient) {
|
||||
message.channel.send(`:no_entry_sign: \`That command does not exist\``);
|
||||
}
|
||||
} else {
|
||||
message.channel.send(`See a full command list at http://www.plane000.co.uk`); //temporary
|
||||
let counter = 0;
|
||||
|
||||
let em = new Discord.RichEmbed();
|
||||
em.setColor('BLUE');
|
||||
em.setTitle('All commands: (Name, Usage)');
|
||||
for (i in commands) {
|
||||
counter++
|
||||
if (counter == 25) {
|
||||
break;
|
||||
}
|
||||
em.addField(commands[i].name + ', ' + commands[i].command, commands[i].usage);
|
||||
}
|
||||
message.channel.send(em);
|
||||
|
||||
|
||||
|
||||
let em1 = new Discord.RichEmbed();
|
||||
em1.setColor('BLUE');
|
||||
em1.setFooter('Do `help [command]` to see more information about the specified command');
|
||||
|
||||
counter = 0
|
||||
for (i in commands) {
|
||||
counter++
|
||||
if (counter >= 25) {
|
||||
em1.addField(commands[i].name + ', ' + commands[i].command, commands[i].usage);
|
||||
}
|
||||
}
|
||||
message.channel.send(em1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.say = async function(message, msg, args, discordclient) {
|
||||
module.exports.say = function(message, msg, args, discordclient) {
|
||||
message.channel.send(msg.slice(4, msg.length));
|
||||
}
|
||||
|
||||
module.exports.version = async function(message, msg, args, discordclient) {
|
||||
module.exports.version = function(message, msg, args, discordclient) {
|
||||
let em = new Discord.RichEmbed();
|
||||
em.setColor('BLUE');
|
||||
em.setTitle('Version:');
|
||||
@@ -43,7 +71,7 @@ module.exports.version = async function(message, msg, args, discordclient) {
|
||||
message.channel.send(em);
|
||||
}
|
||||
|
||||
module.exports.ping = async function(message, msg, args, discordclient) {
|
||||
module.exports.ping = function(message, msg, args, discordclient) {
|
||||
ping.promise.probe("discordapp.com", {
|
||||
timeout: 10
|
||||
}).then((output) => {
|
||||
@@ -77,7 +105,7 @@ module.exports.dog = async function(message, msg, args, discordclient) {
|
||||
message.channel.send(em);
|
||||
}
|
||||
|
||||
module.exports.undo = async function (message, msg, args, discordclient) {
|
||||
module.exports.undo = function (message, msg, args, discordclient) {
|
||||
message.channel.fetchMessages({ limit: 50 })
|
||||
.then((_messages) => {
|
||||
let messages = _messages.array();
|
||||
@@ -91,14 +119,14 @@ module.exports.undo = async function (message, msg, args, discordclient) {
|
||||
.catch();
|
||||
};
|
||||
|
||||
module.exports.hug = async function(message, msg, args, discordclient) {
|
||||
module.exports.hug = function(message, msg, args, discordclient) {
|
||||
let em = new Discord.RichEmbed();
|
||||
em.setColor('BLUE');
|
||||
em.setImage('https://cdn.discordapp.com/attachments/345580737149403146/442232811605458957/cat-instantly-hugs-plush-toy.gif');
|
||||
message.channel.send(em);
|
||||
}
|
||||
|
||||
module.exports.pallet = async function(message, msg, args, discordclient) {
|
||||
module.exports.pallet = function(message, msg, args, discordclient) {
|
||||
if(args[1]) {
|
||||
if (args[1] <= 7) {
|
||||
if (args[1] >= 2) {
|
||||
@@ -132,11 +160,46 @@ module.exports.pallet = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.qr = async function(message, msg, args, discordclient) {
|
||||
module.exports.qr = function(message, msg, args, discordclient) {
|
||||
if (args[1]) {
|
||||
message.channel.send('', new Discord.Attachment(qr.image(msg.substring(3), { type: 'png' })));
|
||||
}
|
||||
else {
|
||||
message.channel.send(':no_entry_sign: \`Please provide what you want turned into a QR code\`');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.is = function(message, msg, args, discordclient) {
|
||||
let thonk = Math.floor(Math.random() * 3);
|
||||
|
||||
if (thonk == 0) {
|
||||
message.channel.send('Yes');
|
||||
} else if (thonk == 1) {
|
||||
message.channel.send('No');
|
||||
} else {
|
||||
message.channel.send('Maybe');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.are = function(message, msg, args, discordclient) {
|
||||
let thonk = Math.floor(Math.random() * 3);
|
||||
|
||||
if (thonk == 0) {
|
||||
message.channel.send('Yes');
|
||||
} else if (thonk == 1) {
|
||||
message.channel.send('No');
|
||||
} else {
|
||||
message.channel.send('Maybe');
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.YEET = function(message, msg, args, discordclient) {
|
||||
message.channel.send('THIS BITCH IS ***__E M P T Y__***');
|
||||
}
|
||||
|
||||
module.exports.dab = function(message, msg, args, discordclient) {
|
||||
let em = new Discord.RichEmbed();
|
||||
em.setColor('BLUE');
|
||||
em.setImage('https://steamuserimages-a.akamaihd.net/ugc/858355614967886347/020C871E91BC00FE277C7D58C3925CAA639F99B0/');
|
||||
message.channel.send(em)
|
||||
}
|
||||
@@ -1,12 +1,13 @@
|
||||
const Discord = require('discord.js');
|
||||
const fs = require('fs');
|
||||
const PImage = require('pureimage');
|
||||
const Config = require('../config.js');
|
||||
const Helper = require('../helper.js');
|
||||
|
||||
/*message object, messaage full, message args, discord client*/
|
||||
|
||||
/*rule commands*/
|
||||
module.exports.rules = async function(message, msg, args, discordclient) {
|
||||
module.exports.rules = function(message, msg, args, discordclient) {
|
||||
let serverName = message.guild.name;
|
||||
let serverID = message.guild.id;
|
||||
let serversConfig = Config.getservers();
|
||||
@@ -23,7 +24,7 @@ module.exports.rules = async function(message, msg, args, discordclient) {
|
||||
message.channel.send(em);
|
||||
}
|
||||
|
||||
module.exports.rule = async function(message, msg, args, discordclient) {
|
||||
module.exports.rule = function(message, msg, args, discordclient) {
|
||||
let serverName = message.guild.name;
|
||||
let serverID = message.guild.id;
|
||||
let serversConfig = Config.getservers();
|
||||
@@ -37,7 +38,7 @@ module.exports.rule = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.addrule = async function(message, msg, args, discordclient) {
|
||||
module.exports.addrule = function(message, msg, args, discordclient) {
|
||||
let serverName = message.guild.name;
|
||||
let serverID = message.guild.id;
|
||||
let serversConfig = Config.getservers();
|
||||
@@ -64,7 +65,7 @@ module.exports.addrule = async function(message, msg, args, discordclient) {
|
||||
message.channel.send(em);
|
||||
}
|
||||
|
||||
module.exports.delrule = async function(message, msg, args, discordclient) {
|
||||
module.exports.delrule = function(message, msg, args, discordclient) {
|
||||
if (args[1]) {
|
||||
let serverName = message.guild.name;
|
||||
let serverID = message.guild.id;
|
||||
@@ -91,7 +92,7 @@ module.exports.delrule = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.editrule = async function(message, msg, args, discordclient) {
|
||||
module.exports.editrule = function(message, msg, args, discordclient) {
|
||||
let serverName = message.guild.name;
|
||||
let serverID = message.guild.id;
|
||||
let serversConfig = Config.getservers();
|
||||
@@ -118,7 +119,7 @@ module.exports.editrule = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
|
||||
/*birthday commands*/
|
||||
module.exports.addbirthday = async function(message, msg, args, discordclient) {
|
||||
module.exports.addbirthday = function(message, msg, args, discordclient) {
|
||||
//input date is [DD/MM/YYYY] such that 14/05/2002
|
||||
let birthdays = Config.getservers()[message.guild.id].birthdays;
|
||||
|
||||
@@ -128,7 +129,7 @@ module.exports.addbirthday = async function(message, msg, args, discordclient) {
|
||||
Config.writeToFile();
|
||||
}
|
||||
|
||||
module.exports.delbirthday = async function(message, msg, args, discordclient) {
|
||||
module.exports.delbirthday = function(message, msg, args, discordclient) {
|
||||
let birthdays = Config.getservers()[message.guild.id].birthdays;
|
||||
|
||||
|
||||
@@ -137,11 +138,11 @@ module.exports.delbirthday = async function(message, msg, args, discordclient) {
|
||||
Config.writeToFile();
|
||||
}
|
||||
|
||||
module.exports.nextbirthday = async function(message, msg, args, discordclient) {
|
||||
module.exports.nextbirthday = function(message, msg, args, discordclient) {
|
||||
let birthdays = Config.getservers()[message.guild.id].birthdays;
|
||||
}
|
||||
|
||||
module.exports.allbirthdays = async function(message, msg, args, discordclient) {
|
||||
module.exports.allbirthdays = function(message, msg, args, discordclient) {
|
||||
let birthdays = Config.getservers()[message.guild.id].birthdays;
|
||||
}
|
||||
|
||||
@@ -253,7 +254,7 @@ module.exports.poll = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.vote = async function(message, msg, args, discordclient) {
|
||||
module.exports.vote = function(message, msg, args, discordclient) {
|
||||
if (polls[message.guild.id]) {
|
||||
let poll = polls[message.guild.id];
|
||||
let hasVoted = false;
|
||||
@@ -284,7 +285,7 @@ module.exports.vote = async function(message, msg, args, discordclient) {
|
||||
|
||||
message.channel.send(`${message.author} voted for ${option}!`);
|
||||
} else {
|
||||
message.channel.send(':no_entry_sign: \`You have allready voted\`');
|
||||
message.channel.send(':no_entry_sign: \`You have already voted\`');
|
||||
}
|
||||
} else {
|
||||
message.channel.send(':no_entry_sign: \`There are no polls running at the moment, use \'poll start\' to start one\`');
|
||||
@@ -324,15 +325,37 @@ module.exports.startGame = async function(message, msg, args, discordclient) {
|
||||
if (!chess[message.guild.id]) {
|
||||
if (args[1]) {
|
||||
try {
|
||||
let player1 = message.mentions.members.first();
|
||||
let player1;
|
||||
|
||||
try {
|
||||
player1 = message.mentions.members.first();
|
||||
} catch (e) {
|
||||
message.channel.send(':no_entry_sign: \`You have not mentioned a user to play with...\`')
|
||||
return;
|
||||
}
|
||||
if (player1.id == message.author.id) {
|
||||
message.channel.send(':no_entry_sign: \`You cannot play with yourself :(\`')
|
||||
return;
|
||||
}
|
||||
if (player1.id == discordclient.user.id) {
|
||||
message.channel.send(':no_entry_sign: \`You cannot play with me :(\`')
|
||||
return;
|
||||
}
|
||||
|
||||
await initBoard(message, message.author, player1);
|
||||
let board = await drawcurrentstate(message);
|
||||
|
||||
|
||||
|
||||
let em = new Discord.RichEmbed();
|
||||
em.setAuthor()
|
||||
message.channel.send('```' + await drawcurrentstate(message) + '```');
|
||||
|
||||
em.addField()
|
||||
//em.setImage(board);
|
||||
|
||||
message.channel.send(em);
|
||||
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
message.channel.send(':no_entry_sign: \`You have not mentioned a user to play with...\`')
|
||||
}
|
||||
} else {
|
||||
@@ -351,8 +374,11 @@ module.exports.move = async function(message, msg, args, discordclient) {
|
||||
//game logic
|
||||
|
||||
|
||||
async function initBoard(message, p1, p2) {
|
||||
async function initBoard(message, p1, p2, channelID) {
|
||||
chess[message.guild.id] = {
|
||||
channel: {
|
||||
id: channelID
|
||||
},
|
||||
board: await initMatrix(8, 8, '-'),
|
||||
prevMoves: [],
|
||||
winner: 0,
|
||||
@@ -460,3 +486,11 @@ async function drawcurrentstate(message) {
|
||||
|
||||
return board;
|
||||
}
|
||||
|
||||
function setupGame(guild) {
|
||||
|
||||
}
|
||||
|
||||
function disbandGame(guild) {
|
||||
|
||||
}
|
||||
@@ -9,15 +9,20 @@ const Helper = require('../helper.js');
|
||||
module.exports.nextlaunch = async function(message, msg, args, discordclient) {
|
||||
let url = 'https://launchlibrary.net/1.4/launch/next/1';
|
||||
try {
|
||||
try {
|
||||
let launch = JSON.parse(result).launches[0];
|
||||
|
||||
let em = new Discord.RichEmbed();
|
||||
em.setTitle(launch.name);
|
||||
em.setColor('BLUE');
|
||||
em.setAuthor('Next Launch Info:', 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e5/NASA_logo.svg/1200px-NASA_logo.svg.png', 'https://spaceflightnow.com/launch-schedule/');
|
||||
em.setThumbnail('https://www.nasa.gov/sites/default/files/saturnv-3_0.jpg');
|
||||
em.url = launch.location.pads[0].mapURL;
|
||||
} catch (e) {
|
||||
message.channel.send(`:no_entry_sign: \`There was a problem with the API...\``);
|
||||
return;
|
||||
}
|
||||
let result = await Helper.requestPromise(url);
|
||||
let launch = JSON.parse(result).launches[0];
|
||||
|
||||
let em = new Discord.RichEmbed();
|
||||
em.setTitle(launch.name);
|
||||
em.setColor('BLUE');
|
||||
em.setAuthor('Next Launch Info:', 'https://upload.wikimedia.org/wikipedia/commons/thumb/e/e5/NASA_logo.svg/1200px-NASA_logo.svg.png', 'https://spaceflightnow.com/launch-schedule/');
|
||||
em.setThumbnail('https://www.nasa.gov/sites/default/files/saturnv-3_0.jpg');
|
||||
em.url = launch.location.pads[0].mapURL;
|
||||
|
||||
let status = 'Unknown';
|
||||
if (launch.status == 1) {
|
||||
@@ -75,17 +80,10 @@ module.exports.nextlaunch = async function(message, msg, args, discordclient) {
|
||||
|
||||
message.channel.send(em);
|
||||
|
||||
<<<<<<< HEAD
|
||||
em.addField('Agency Name:', missionagency.name, true);
|
||||
em.addField('Agency Region:', missionagency.countryCode, true);
|
||||
|
||||
|
||||
=======
|
||||
} catch (e) {
|
||||
message.channel.send(`:no_entry_sign: \`There was a problem with the API...\``);
|
||||
}
|
||||
}
|
||||
>>>>>>> d2e2c160e6597833c3bdf44372777e81e32eeb97
|
||||
|
||||
module.exports.spaceimg = async function(message, msg, args, discordclient) {
|
||||
if (args.length >= 2) {
|
||||
@@ -121,12 +119,12 @@ module.exports.spaceimg = async function(message, msg, args, discordclient) {
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.pictureoftheday = async function(message, msg, args, discordclient) {
|
||||
module.exports.pictureoftheday = function(message, msg, args, discordclient) {
|
||||
let apiKey = Config.getconfig().NASA_APIKey;
|
||||
let url = 'https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY';
|
||||
}
|
||||
|
||||
module.exports.nearearthobj = async function(message, msg, args, discordclient) {
|
||||
module.exports.nearearthobj = function(message, msg, args, discordclient) {
|
||||
let apiKey = Config.getconfig().NASA_APIKey;
|
||||
let url = 'https://api.nasa.gov/neo/rest/v1/neo/browse?api_key=DEMO_KEY';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user