Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Switch changes to 'my' command #38

Open
wants to merge 14 commits into
base: sog
Choose a base branch
from
Open
16 changes: 12 additions & 4 deletions bot/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,22 @@ bot.on("debug", function (msg) {
bot.once("ready", function () {
bot.user.setStatus("online", "Global Thermonuclear War with WOPR");
logger.info("%s is ready!", bot.user.username);
logger.verbose("Listening to %s channels on %s servers", bot.channels.array().length, bot.guilds.array().length);
logger.verbose("Listening to %s channels on %s servers", bot.channels.size, bot.guilds.size);

// configure the default servers
if(app.defaultServer = bot.guilds.find("name", config.discord.defaultServer)) {
logger.info("setting default server to: %s [%s]", app.defaultServer.name, app.defaultServer.id);
if(bot.guilds.size === 1) {
// only one server - ezpz
app.defaultServer = bot.guilds.first();
} else if(config.discord.defaultServer) {
app.defaultServer = bot.guilds.find("name", config.discord.defaultServer)
}

if(!app.defaultServer) {
logger.warn("unable to determine default server");
} else {
logger.warn("unable to find default server: %s", config.discord.defaultServer);
logger.info("setting default server to: [%s]", app.defaultServer.name);
}

});

bot.on("disconnect", function (e) {
Expand Down
24 changes: 12 additions & 12 deletions bot/modules/destiny/commands/advisors.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ function trials(format, activities, definitions, destinations) {

var detailTable = new Table({
chars: detailBorders,
style: { 'padding-left': 0, 'padding-right': 0 },
style: { 'padding-left': 0, 'padding-right': 0, 'border': 'blue' },
colWidths: [10, lineLength - 10 - 3],
colAligns: [ 'right', 'left'],
wordWrap: true
Expand Down Expand Up @@ -83,7 +83,7 @@ function trials(format, activities, definitions, destinations) {

var rewardTable = new Table({
chars: detailBorders,
style: { 'padding-left': 0, 'padding-right': 0 },
style: { 'padding-left': 0, 'padding-right': 0, 'border': 'blue' },
//colWidths: [10, lineLength - 10 - 3],
colAligns: [ 'right', 'left'],
wordWrap: true
Expand All @@ -93,7 +93,10 @@ function trials(format, activities, definitions, destinations) {
// lookup the reward
// item.itemDescription
var item = yield manifest.getDestinyInventoryItemDefinition(rewards[reward], 'en');
rewardTable.push([item.itemTypeName, item.itemName]);
if(item) {
rewardTable.push([item.itemTypeName, item.itemName]);
}

}

toSend.push(rewardTable.toString().replace(/ +\n/g, "\n"));
Expand All @@ -111,7 +114,7 @@ function trials(format, activities, definitions, destinations) {
//
function singleTier(format, activity, definitions, destinations) {

logger.verbose('reporting ' + activity.display.advisorTypeCategory);
// logger.verbose('reporting ' + activity.display.advisorTypeCategory);

var activityHash = activity.display.activityHash;
var activityInfo = definitions.activities[activityHash];
Expand All @@ -121,7 +124,7 @@ function singleTier(format, activity, definitions, destinations) {

var detailTable = new Table({
chars: detailBorders,
style: { 'padding-left': 0, 'padding-right': 0 },
style: { 'padding-left': 0, 'padding-right': 0, 'border': 'blue' },
colWidths: [10, lineLength - 10 - 3],
wordWrap: true
});
Expand All @@ -135,7 +138,7 @@ function singleTier(format, activity, definitions, destinations) {

var skullsTable = new Table({
chars: detailBorders,
style: { 'padding-left': 0, 'padding-right': 0 },
style: { 'padding-left': 0, 'padding-right': 0, 'border': 'blue' },
colWidths: [10, lineLength - 10 - 3],
wordWrap: true
});
Expand Down Expand Up @@ -309,7 +312,6 @@ function exec(cmd) {
*/
var destinations = definitions.destinations;


var toSend = [];
switch (input.toLowerCase()) {
case 'trials':
Expand All @@ -319,17 +321,15 @@ function exec(cmd) {
case 'daily':
case 'dailystory':
case 'story':
toSend.push(singleTier(cmd.format, activities['dailychapter'], definitions, destinations));
toSend.push(singleTier(cmd.format, activities['weeklystory'], definitions, destinations));
break;
case 'weekly':
case 'weeklystrike':
case 'strike':
toSend.push(singleTier(cmd.format, activities['heroicstrike'], definitions, destinations));
toSend.push(singleTier(cmd.format, activities['nightfall'], definitions, destinations));
break;
case 'all':
//toSend.push(dailyChapter(cmd.format, activities, definitions, destinations));
//toSend.push(heroicStrike(cmd.format, activities, definitions, destinations));
toSend.push(singleTier(cmd.format, activities['dailychapter'], definitions, destinations));
toSend.push(singleTier(cmd.format, activities['weeklystory'], definitions, destinations));
toSend.push(singleTier(cmd.format, activities['heroicstrike'], definitions, destinations));
toSend.push(singleTier(cmd.format, activities['nightfall'], definitions, destinations));
toSend.push(yield trials(cmd.format, activities, definitions, destinations));
Expand Down
16 changes: 8 additions & 8 deletions bot/modules/gamer/commands/my.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ function exec(cmd) {
toSend.push(" XBL: " + g.xbl);
if (g.fc)
toSend.push(" 3DS Friend Code: " + g.fc);
if (g.mn)
toSend.push(" My Nintendo: " + g.mn);
if (g.nsfc)
toSend.push(" Switch Friend Code: " + g.nsfc);
if (g.steam)
toSend.push(" Steam: " + g.steam);
if (g.uplay)
Expand Down Expand Up @@ -115,17 +115,17 @@ function exec(cmd) {
return message.send(msg, "Removed 3DS Friend Code ", cmd.pm);
}

case 'mn':
case 'nintendo':
case 'nsfc':
case 'switch':
yield db.collection(config.modules.gamer.collection).updateOne(
{ "discord.id": msg.author.id },
{ $set: { mn: args[0], "discord.name" : msg.author.username, modified: true } },
{ $set: { nsfc: args[0], "discord.name" : msg.author.username, modified: true } },
{ upsert: true }
);
if(args[0]) {
return message.send(msg, "Updated My Nintendo username to: "+args[0], cmd.pm);
return message.send(msg, "Updated Switch Friend code to: "+args[0], cmd.pm);
} else {
return message.send(msg, "Removed My Nintendo username", cmd.pm);
return message.send(msg, "Removed Switch Friend code", cmd.pm);
}

case 'steam':
Expand Down Expand Up @@ -261,7 +261,7 @@ module.exports = {
"\t\t`xbl <xbl gamertag>` - set your xbl gamertag",
"\t\t`psn <psn id>` - set your psn id",
"\t\t`fc <3ds fc>` - set your 3ds friendcode",
"\t\t`mn <mn>` - set your my nintendo username",
"\t\t`nsfc <nsfc>` - set your switch friendcode",
"\t\t`steam <steam username>` - set your steam username",
"\t\t`uplay <uplay username>` - set your uplay username",
"\t\t`origin <origin username>` - set your origin username",
Expand Down
88 changes: 0 additions & 88 deletions bot/modules/role/commands/role.js

This file was deleted.

96 changes: 0 additions & 96 deletions bot/modules/role/commands/sar.js

This file was deleted.

20 changes: 0 additions & 20 deletions bot/modules/role/index.js

This file was deleted.

Loading