Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
feat: various updates
Browse files Browse the repository at this point in the history
- Move statistics back into `/bot`
- Remove credits
- Update `/bot` buttons
- Remove `/vote`, moved to `/bot`
- Update to-do list buttons
- Make `/admin` ephemeral
- Make get role commands ephemeral
- Fix `guildDelete` event
- Remove `axios` dependency
- Remove `moment` dependency
- Update context menu commands JSON
- Rename to-do list button IDs
  • Loading branch information
wdhdev committed Jul 9, 2023
1 parent e6c2c87 commit 3ff4f98
Show file tree
Hide file tree
Showing 19 changed files with 60 additions and 206 deletions.
62 changes: 0 additions & 62 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
"license": "MIT",
"dependencies": {
"@sentry/node": "^7.53.1",
"axios": "^1.4.0",
"body-parser": "^1.20.2",
"cors": "^2.8.5",
"discord.js": "^14.11.0",
"dotenv": "^16.3.1",
"express": "^4.18.2",
"moment": "^2.29.4",
"mongoose": "^6.11.2",
"node-fetch": "^2.6.9",
"stop-discord-phishing": "^0.3.3"
Expand Down
20 changes: 0 additions & 20 deletions src/buttons/info/credits.js

This file was deleted.

48 changes: 0 additions & 48 deletions src/buttons/info/statistics.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/buttons/to-do-list/add.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const emoji = require("../../config.json").emojis;
const todoSchema = require("../../models/todoSchema");

module.exports = {
name: "add-todo",
name: "add-task",
startsWith: false,
requiredRoles: ["dev"],
async execute(interaction, client, Discord) {
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/to-do-list/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const emoji = require("../../config.json").emojis;
const todoSchema = require("../../models/todoSchema");

module.exports = {
name: "get-todo",
name: "get-task",
startsWith: false,
requiredRoles: [],
async execute(interaction, client, Discord) {
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/to-do-list/refresh.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
const todoSchema = require("../../models/todoSchema");

module.exports = {
name: "refresh-todo-list",
name: "refresh-task-list",
startsWith: false,
requiredRoles: [],
async execute(interaction, client, Discord) {
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/to-do-list/remove.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const emoji = require("../../config.json").emojis;
const todoSchema = require("../../models/todoSchema");

module.exports = {
name: "remove-todo",
name: "remove-task",
startsWith: false,
requiredRoles: ["dev"],
async execute(interaction, client, Discord) {
Expand Down
26 changes: 13 additions & 13 deletions src/commands/dev/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ module.exports = {
enabled: true,
hidden: true,
deferReply: true,
ephemeral: false,
ephemeral: true,
async execute(interaction, client, Discord) {
try {
const logsChannel = client.channels.cache.get(client.config_channels.logs);
Expand Down Expand Up @@ -272,7 +272,7 @@ module.exports = {

const immuneUsers = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle("🚫 Immune Users")
.setTitle("🔒 Immune Users")
.setDescription(`<@${users.join(">, <@")}>`)

await interaction.editReply({ embeds: [immuneUsers] });
Expand Down Expand Up @@ -437,27 +437,27 @@ module.exports = {
const row1 = new Discord.ActionRowBuilder()
.addComponents (
new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Success)
.setCustomId("add-todo")
.setLabel("Add Task"),
.setStyle(Discord.ButtonStyle.Primary)
.setCustomId("get-task")
.setLabel("Get"),

new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Danger)
.setCustomId("remove-todo")
.setLabel("Remove Task"),
.setStyle(Discord.ButtonStyle.Success)
.setCustomId("add-task")
.setLabel("Add"),

new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Primary)
.setCustomId("get-todo")
.setLabel("Get Task")
.setStyle(Discord.ButtonStyle.Danger)
.setCustomId("remove-task")
.setLabel("Remove")
)

const row2 = new Discord.ActionRowBuilder()
.addComponents (
new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Secondary)
.setCustomId("refresh-todo-list")
.setEmoji("🔃")
.setCustomId("refresh-task-list")
.setLabel("Refresh")
)

try {
Expand Down
58 changes: 38 additions & 20 deletions src/commands/info/bot.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
const bot = require("../../../package.json");
const moment = require("moment");

const devSchema = require("../../models/devSchema");
const messageSchema = require("../../models/messageSchema");
const modSchema = require("../../models/modSchema");
const verifiedSchema = require("../../models/verifiedSchema");

module.exports = {
name: "bot",
Expand All @@ -21,25 +25,39 @@ module.exports = {
.setDescription(bot.description)
.addFields (
{ name: "📈 Version", value: bot.version, inline: true },
{ name: "🟢 Online Since", value: `<t:${Math.floor(moment(Date.now() - client.uptime) / 1000)}:f> (<t:${Math.floor(moment(Date.now() - client.uptime) / 1000)}:R>)`, inline: true }
{ name: "🟢 Online Since", value: `<t:${(Date.now() - client.uptime).toString().slice(0, -3)}:f> (<t:${(Date.now() - client.uptime).toString().slice(0, -3)}:R>)`, inline: true }
)

const row_1 = new Discord.ActionRowBuilder()
.addComponents (
new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Secondary)
.setCustomId("statistics")
.setEmoji("📊")
.setLabel("Statistics"),
const developers = await devSchema.find();
const moderators = await modSchema.find();
const verifiedUsers = await verifiedSchema.find();
const messages = await messageSchema.find();
const images = await messageSchema.find({ attachment: { $ne: null } });

new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Secondary)
.setCustomId("credits")
.setEmoji("✨")
.setLabel("Credits")
const guild = await client.guilds.fetch(client.config_default.guild);
const members = await guild.members.fetch();
const boosters = members.filter(member => member.premiumSinceTimestamp);

const stat_guilds = `🗄️ ${client.guilds.cache.size} Guild${client.guilds.cache.size === 1 ? "" : "s"}`;
const stat_users = `👤 ${client.users.cache.size} User${client.users.cache.size === 1 ? "" : "s"}`;

const stat_developers = `💻 ${developers.length} Developer${developers.length === 1 ? "" : "s"}`;
const stat_moderators = `🔨 ${moderators.length} Moderator${moderators.length === 1 ? "" : "s"}`;
const stat_verified = `✅ ${verifiedUsers.length} Verified User${verifiedUsers.length === 1 ? "" : "s"}`;
const stat_supporters = `💖 ${boosters.size} Supporter${boosters.size === 1 ? "" : "s"}`;

const stat_messages = `💬 ${messages.length} Message${messages.length === 1 ? "" : "s"}`;
const stat_images = `🖼️ ${images.length} Image${images.length === 1 ? "" : "s"}`;

const statistics = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.addFields (
{ name: "🤖 Bot", value: `${stat_guilds}\n${stat_users}`, inline: true },
{ name: "🎭 Roles", value: `${stat_developers}\n${stat_moderators}\n${stat_verified}\n${stat_supporters}`, inline: true },
{ name: "🌐 Global Chat", value: `${stat_messages}\n${stat_images}`, inline: true }
)

const row_2 = new Discord.ActionRowBuilder()
const buttons = new Discord.ActionRowBuilder()
.addComponents (
new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Link)
Expand All @@ -49,18 +67,18 @@ module.exports = {

new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Link)
.setEmoji("🤝")
.setEmoji("🆘")
.setLabel("Support")
.setURL("https://discord.gg/globalchat"),

new Discord.ButtonBuilder()
.setStyle(Discord.ButtonStyle.Link)
.setEmoji("📜")
.setLabel("Terms")
.setURL("https://wdh.gg/gc-terms")
.setEmoji("🗳️")
.setLabel("Vote")
.setURL("https://wdh.gg/gc-vote")
)

await interaction.editReply({ embeds: [info], components: [row_1, row_2] });
await interaction.editReply({ embeds: [info, statistics], components: [buttons] });
} catch(err) {
client.logCommandError(err, interaction, Discord);
}
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/developers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
enabled: true,
hidden: false,
deferReply: true,
ephemeral: false,
ephemeral: true,
async execute(interaction, client, Discord) {
try {
const devs = await devSchema.find();
Expand Down
2 changes: 1 addition & 1 deletion src/commands/info/moderators.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {
enabled: true,
hidden: false,
deferReply: true,
ephemeral: false,
ephemeral: true,
async execute(interaction, client, Discord) {
try {
const mods = await modSchema.find();
Expand Down
Loading

0 comments on commit 3ff4f98

Please sign in to comment.