settings view
This commit is contained in:
2 files changed
+37
-4
No files matched your search
+30
-1
@@ -1,4 +1,4 @@
|
|||||||
const { MessageEmbed } = require('discord.js');
|
const { MessageEmbed, Guild } = require('discord.js');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: "settings",
|
name: "settings",
|
||||||
@@ -135,6 +135,12 @@ module.exports = {
|
|||||||
required: true,
|
required: true,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "view",
|
||||||
|
description: "view current settings configuration",
|
||||||
|
value: "view",
|
||||||
|
type: 1,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
/**
|
/**
|
||||||
@@ -478,6 +484,29 @@ module.exports = {
|
|||||||
.setColor('GREEN');
|
.setColor('GREEN');
|
||||||
|
|
||||||
return interaction.send({ embeds: [successEmbed] });
|
return interaction.send({ embeds: [successEmbed] });
|
||||||
|
|
||||||
|
} else if (args[0].name == 'view') {
|
||||||
|
const tweetChannel = client.exists(GuildDB.tweetChannel) ? `\n╚➤ <#${GuildDB.tweetChannel}>` : '';
|
||||||
|
const tweetColor = client.exists(GuildDB.tweetChannel) ? '+ ' : '- ';
|
||||||
|
const actionChannel = client.exists(GuildDB.actionChannel) ? `\n╚➤ <#${GuildDB.actionChannel}>` : '';
|
||||||
|
const actionColor = client.exists(GuildDB.actionChannel) ? '+ ' : '- ';
|
||||||
|
const channelsInfo = GuildDB.customChannelStatus ? '\n╚➤ \`/channels\` to view' : '';
|
||||||
|
const channelColor = GuildDB.customChannelStatus ? '+ ' : '- ';
|
||||||
|
const incomeInfo = GuildDB.incomeRoleStatus ? '\n╚➤ \`/work-roles\` to view' : '';
|
||||||
|
const incomeColor = GuildDB.incomeRoleStatus ? '+ ' : '- ';
|
||||||
|
const settingsEmbed = new MessageEmbed()
|
||||||
|
.setColor(client.config.EmbedColor)
|
||||||
|
.setTitle('Current Guild Configurations')
|
||||||
|
.addFields(
|
||||||
|
{ name: 'Guild ID', value: `\`\`\`arm\n${GuildDB.serverID}\`\`\``, inline: true },
|
||||||
|
{ name: 'Has Income Roles?', value: `\`\`\`diff\n${incomeColor}${GuildDB.incomeRoleStatus}\`\`\`${incomeInfo}`, inline: true },
|
||||||
|
{ name: 'Has Allowed Channels?', value: `\`\`\`diff\n${channelColor}${GuildDB.customChannelStatus}\`\`\`${channelsInfo}`, inline: true },
|
||||||
|
{ name: 'Has Tweet Channel?', value: `\`\`\`diff\n${tweetColor}${client.exists(GuildDB.tweetChannel)}\`\`\`${tweetChannel}`, inline: true },
|
||||||
|
{ name: 'Has Action Channel?', value: `\`\`\`diff\n${actionColor}${client.exists(GuildDB.actionChannel)}\`\`\`${actionChannel}`, inline: true },
|
||||||
|
{ name: 'Starting Balance', value: `\`\`\`arm\n$${GuildDB.startingBalance}\`\`\``, inline: true },
|
||||||
|
);
|
||||||
|
|
||||||
|
return interaction.send({ embeds: [settingsEmbed] });
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class QuarksBot extends Client {
|
|||||||
let serverID = GuildId;
|
let serverID = GuildId;
|
||||||
let customChannelStatus, allowedChannels;
|
let customChannelStatus, allowedChannels;
|
||||||
let actionChannel, tweetChannel;
|
let actionChannel, tweetChannel;
|
||||||
let startingBalance, incomeRoles;
|
let startingBalance, incomeRoles, incomeRoleStatus;
|
||||||
let guild = await this.dbo.collection("guilds").findOne({"server.serverID":GuildId}).then(guild => guild);
|
let guild = await this.dbo.collection("guilds").findOne({"server.serverID":GuildId}).then(guild => guild);
|
||||||
|
|
||||||
// If guild not found, generate guild default
|
// If guild not found, generate guild default
|
||||||
@@ -138,24 +138,27 @@ class QuarksBot extends Client {
|
|||||||
actionChannel: null,
|
actionChannel: null,
|
||||||
tweetChannel: null,
|
tweetChannel: null,
|
||||||
startingBalance: 1000.00,
|
startingBalance: 1000.00,
|
||||||
|
hasIncomeRoles: false,
|
||||||
incomeRoles: [],
|
incomeRoles: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.dbo.collection("guilds").insertOne(newGuild, function(err, res) {
|
this.dbo.collection("guilds").insertOne(newGuild, function(err, res) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
});
|
});
|
||||||
customChannelStatus = newGuild.server.hasCustomChannels;
|
customChannelStatus = false;
|
||||||
allowedChannels = newGuild.server.allowedChannels;
|
allowedChannels = newGuild.server.allowedChannels;
|
||||||
actionChannel = newGuild.server.actionChannel;
|
actionChannel = newGuild.server.actionChannel;
|
||||||
tweetChannel = newGuild.server.tweetChannel;
|
tweetChannel = newGuild.server.tweetChannel;
|
||||||
startingBalance = newGuild.server.startingBalance;
|
startingBalance = newGuild.server.startingBalance;
|
||||||
|
incomeRoleStatus = newGuild.server.hasIncomeRoles
|
||||||
incomeRoles = newGuild.server.incomeRoles;
|
incomeRoles = newGuild.server.incomeRoles;
|
||||||
} else {
|
} else {
|
||||||
customChannelStatus = guild.server.hasCustomChannels;
|
customChannelStatus = guild.server.allowedChannels.length > 0 ? true : false;
|
||||||
allowedChannels = guild.server.allowedChannels;
|
allowedChannels = guild.server.allowedChannels;
|
||||||
actionChannel = guild.server.actionChannel;
|
actionChannel = guild.server.actionChannel;
|
||||||
tweetChannel = guild.server.tweetChannel;
|
tweetChannel = guild.server.tweetChannel;
|
||||||
startingBalance = guild.server.startingBalance;
|
startingBalance = guild.server.startingBalance;
|
||||||
|
incomeRoleStatus = guild.server.incomeRoles.length > 0 ? true : false;
|
||||||
incomeRoles = guild.server.incomeRoles;
|
incomeRoles = guild.server.incomeRoles;
|
||||||
}
|
}
|
||||||
let guildData = {
|
let guildData = {
|
||||||
@@ -165,6 +168,7 @@ class QuarksBot extends Client {
|
|||||||
actionChannel: actionChannel,
|
actionChannel: actionChannel,
|
||||||
tweetChannel: tweetChannel,
|
tweetChannel: tweetChannel,
|
||||||
startingBalance: startingBalance,
|
startingBalance: startingBalance,
|
||||||
|
incomeRoleStatus: incomeRoleStatus,
|
||||||
incomeRoles: incomeRoles,
|
incomeRoles: incomeRoles,
|
||||||
}
|
}
|
||||||
return guildData;
|
return guildData;
|
||||||
|
|||||||
Reference in new issue
Block a user