mirror of
https://github.com/Ratstail91/SANCTUM.git
synced 2025-11-29 02:24:27 +11:00
Testing and bugfixing
This commit is contained in:
@@ -140,14 +140,14 @@ function processBasicCommands(client, message) {
|
|||||||
//ADAM and the faction leaders print the intros in the gate
|
//ADAM and the faction leaders print the intros in the gate
|
||||||
//TODO: prune the unneeded intros from each bot
|
//TODO: prune the unneeded intros from each bot
|
||||||
case "intro":
|
case "intro":
|
||||||
if (shared.IsAdmin(client, message.author)) {
|
if (shared.IsAdmin(client, message.author) && message.channel.id !== process.env.GATE_CHANNEL_ID) {
|
||||||
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("intro"));
|
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("intro"));
|
||||||
message.delete(1000);
|
message.delete(1000);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "introend":
|
case "introend":
|
||||||
if (shared.IsAdmin(client, message.author)) {
|
if (shared.IsAdmin(client, message.author) && message.channel.id !== process.env.GATE_CHANNEL_ID) {
|
||||||
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introEnd"));
|
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introEnd"));
|
||||||
message.delete(1000);
|
message.delete(1000);
|
||||||
}
|
}
|
||||||
|
|||||||
21
ADAM/core.js
21
ADAM/core.js
@@ -29,7 +29,12 @@ exports.ProcessGameplayCommands = function(client, message, dialog) {
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
case "give": //TODO: fold this code into a function
|
case "give": //TODO: fold this code into a function
|
||||||
let amount = Math.floor(args[0]);
|
let amount = Math.floor(parseFloat(args[0]));
|
||||||
|
|
||||||
|
if (isNaN(amount)) {
|
||||||
|
shared.SendPublicMessage(client, message.channel, dialog("giveFailed", message.author.id));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
//not enough
|
//not enough
|
||||||
if (amount <= 0) {
|
if (amount <= 0) {
|
||||||
@@ -202,7 +207,7 @@ exports.PrintStats = function(client, member, channel, stats) {
|
|||||||
.addField("Stats", userStats)
|
.addField("Stats", userStats)
|
||||||
.setFooter("Commands: !help | !lore | !checkin | !give");
|
.setFooter("Commands: !help | !lore | !checkin | !give");
|
||||||
|
|
||||||
channel.send(embed);
|
channel.send({ embed });
|
||||||
}
|
}
|
||||||
|
|
||||||
//HandleLevelUp
|
//HandleLevelUp
|
||||||
@@ -211,6 +216,18 @@ exports.PrintStats = function(client, member, channel, stats) {
|
|||||||
//channel - discord.js channel
|
//channel - discord.js channel
|
||||||
//dialog - dialog function
|
//dialog - dialog function
|
||||||
exports.HandleLevelUp = function(client, member, channel, dialog) {
|
exports.HandleLevelUp = function(client, member, channel, dialog) {
|
||||||
|
//handle member strings
|
||||||
|
if (typeof(member) === "string") { //TODO: fold these into their own functions EVERYWHERE.
|
||||||
|
//get the member
|
||||||
|
let user = client.users.find(item => item.username === member || item.id === member);
|
||||||
|
member = guild.members.get(user.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
//handle channel strings
|
||||||
|
if (typeof(channel) === "string") {
|
||||||
|
channel = client.channels.find(item => item.name === channel || item.id === channel);
|
||||||
|
}
|
||||||
|
|
||||||
// Sees if the user is supposed to level up
|
// Sees if the user is supposed to level up
|
||||||
let [levelUpResponse, level, statPoints] = shared.LevelUp(client, member);
|
let [levelUpResponse, level, statPoints] = shared.LevelUp(client, member);
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ function processBasicCommands(client, message) {
|
|||||||
|
|
||||||
//ADAM and the faction leaders print the intros in the gate
|
//ADAM and the faction leaders print the intros in the gate
|
||||||
case "introgenesis":
|
case "introgenesis":
|
||||||
if (shared.IsAdmin(client, message.author)) {
|
if (shared.IsAdmin(client, message.author) && message.channel.id !== process.env.GATE_CHANNEL_ID) {
|
||||||
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introGenesis", process.env.GROUP_B_ROLE));
|
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introGenesis", process.env.GROUP_B_ROLE));
|
||||||
message.delete(1000);
|
message.delete(1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,8 +91,9 @@ function processBasicCommands(client, message) {
|
|||||||
case "hand":
|
case "hand":
|
||||||
return core.ProcessFactionChangeAttempt(client, message, process.env.GROUP_C_ROLE, dialog, "Hand");
|
return core.ProcessFactionChangeAttempt(client, message, process.env.GROUP_C_ROLE, dialog, "Hand");
|
||||||
|
|
||||||
|
//ADAM and the faction leaders print the intros in the gate
|
||||||
case "introhand":
|
case "introhand":
|
||||||
if (shared.IsAdmin(client, message.author)) {
|
if (shared.IsAdmin(client, message.author) && message.channel.id !== process.env.GATE_CHANNEL_ID) {
|
||||||
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introHand", process.env.GROUP_C_ROLE));
|
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introHand", process.env.GROUP_C_ROLE));
|
||||||
message.delete(1000);
|
message.delete(1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ function processBasicCommands(client, message) {
|
|||||||
|
|
||||||
//ADAM and the faction leaders print the intros in the gate
|
//ADAM and the faction leaders print the intros in the gate
|
||||||
case "introobsidian":
|
case "introobsidian":
|
||||||
if (shared.IsAdmin(client, message.author)) {
|
if (shared.IsAdmin(client, message.author) && message.channel.id !== process.env.GATE_CHANNEL_ID) {
|
||||||
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introObsidian", process.env.GROUP_A_ROLE));
|
shared.SendPublicMessage(client, client.channels.get(process.env.GATE_CHANNEL_ID), dialog("introObsidian", process.env.GROUP_A_ROLE));
|
||||||
message.delete(1000);
|
message.delete(1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,12 @@ let request = require("sync-request");
|
|||||||
|
|
||||||
exports.LoadServerData = function(dataType, usersID = "") {
|
exports.LoadServerData = function(dataType, usersID = "") {
|
||||||
let response = request("GET", `${process.env.SERVER_ADDRESS}/getData.php?pk=${process.env.SERVER_PASS_KEY}&dataType=${dataType}&userid=${usersID}`);
|
let response = request("GET", `${process.env.SERVER_ADDRESS}/getData.php?pk=${process.env.SERVER_PASS_KEY}&dataType=${dataType}&userid=${usersID}`);
|
||||||
|
// console.log(response.getBody());
|
||||||
return response.getBody();
|
return response.getBody();
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.SendServerData = function(dataType, usersID = "", dataToSend="", dataToSend2 = ""){
|
exports.SendServerData = function(dataType, usersID = "", dataToSend="", dataToSend2 = ""){
|
||||||
let response = request("GET", `${process.env.SERVER_ADDRESS}/sendData.php?pk=${process.env.SERVER_PASS_KEY}&dataType=${dataType}&userid=${usersID}&dataToSend=${dataToSend}&dataToSend2=${dataToSend2}`);
|
let response = request("GET", `${process.env.SERVER_ADDRESS}/sendData.php?pk=${process.env.SERVER_PASS_KEY}&dataType=${dataType}&userid=${usersID}&dataToSend=${dataToSend}&dataToSend2=${dataToSend2}`);
|
||||||
|
// console.log(response.getBody());
|
||||||
return response.getBody();
|
return response.getBody();
|
||||||
}
|
}
|
||||||
|
|||||||
17
package.json
17
package.json
@@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Sanctuary",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"description": "A text-based massively multiplayer game about the survival of the fittest.",
|
|
||||||
"main": "index.js",
|
|
||||||
"scripts": {
|
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
|
||||||
},
|
|
||||||
"author": "Tim",
|
|
||||||
"license": "ISC",
|
|
||||||
"dependencies": {
|
|
||||||
"discord.io": "github:woor/discord.io#gateway_v6",
|
|
||||||
"dotenv": "^6.0.0",
|
|
||||||
"node-cron": "^1.2.1",
|
|
||||||
"sync-request": "^6.0.0"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user