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

Commit

Permalink
feat: username system update + other stuff
Browse files Browse the repository at this point in the history
- Don't use `@` in new usernames
- Remove `/credits`, is now a button response on `/bot`
- Remove statistics embed from `/bot`, is now a button response
- Remove unused sentry-api endpoints
  • Loading branch information
wdhdev committed Jul 8, 2023
1 parent 52efb38 commit a046fd7
Show file tree
Hide file tree
Showing 42 changed files with 133 additions and 153 deletions.
4 changes: 2 additions & 2 deletions src/buttons/appeals/approve.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ module.exports = {

const approved = new Discord.EmbedBuilder()
.setColor(client.config_embeds.green)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("✅ Approved")
.setDescription(`${reason}`)
.setTimestamp()
Expand All @@ -101,7 +101,7 @@ module.exports = {

const appealLog = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("✅ Appeal Approved")
.addFields (
{ name: "📄 Appeal", value: id },
Expand Down
4 changes: 2 additions & 2 deletions src/buttons/appeals/deny.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ module.exports = {

const denied = new Discord.EmbedBuilder()
.setColor(client.config_embeds.red)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("❌ Denied")
.setDescription(`${reason}`)
.setTimestamp()
Expand All @@ -99,7 +99,7 @@ module.exports = {

const appealLog = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("❌ Appeal Denied")
.addFields (
{ name: "📄 Appeal", value: id },
Expand Down
File renamed without changes.
15 changes: 3 additions & 12 deletions src/commands/info/credits.js → src/buttons/info/credits.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,20 @@
module.exports = {
name: "credits",
description: "Credits for the bot.",
options: [],
default_member_permissions: null,
botPermissions: [],
startsWith: false,
requiredRoles: [],
cooldown: 5,
enabled: true,
hidden: false,
deferReply: true,
ephemeral: true,
async execute(interaction, client, Discord) {
try {
const credits = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle("Credits")
.addFields (
{ name: "💻 Developer", value: "[@william.harrison](https://discord.com/users/853158265466257448)" },
{ name: "🪝 Webhook System", value: "[@andrewstech](https://discord.com/users/598245488977903688)" },
{ name: "💡 Bot Inspiration", value: "[@sx9dev](https://discord.com/users/882595027132493864)" }
)

await interaction.editReply({ embeds: [credits] });
await interaction.reply({ embeds: [credits], ephemeral: true });
} catch(err) {
client.logCommandError(err, interaction, Discord);
client.logButtonError(err, interaction, Discord);
}
}
}
48 changes: 48 additions & 0 deletions src/buttons/info/statistics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
const devSchema = require("../../models/devSchema");
const messageSchema = require("../../models/messageSchema");
const modSchema = require("../../models/modSchema");
const verifiedSchema = require("../../models/verifiedSchema");

module.exports = {
name: "statistics",
startsWith: false,
requiredRoles: [],
async execute(interaction, client, Discord) {
try {
await interaction.deferReply({ ephemeral: true });

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 } });

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}` },
{ name: "🎭 Roles", value: `${stat_developers}\n${stat_moderators}\n${stat_verified}\n${stat_supporters}` },
{ name: "🌐 Global Chat", value: `${stat_messages}\n${stat_images}` }
)

await interaction.editReply({ embeds: [statistics] });
} catch(err) {
client.logButtonError(err, interaction, Discord);
}
}
}
4 changes: 2 additions & 2 deletions src/buttons/logs/blocked-message-ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = {
} catch {}

const banInfo = new Discord.EmbedBuilder()
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("Banned")
.addFields (
{ name: "❓ Reason", value: `${reason}` },
Expand All @@ -152,7 +152,7 @@ module.exports = {

const banLog = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("User Banned")
.addFields (
{ name: "👤 User", value: `${user}` },
Expand Down
6 changes: 3 additions & 3 deletions src/buttons/logs/delete-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = {

const result = new Discord.EmbedBuilder()
.setColor(client.config_embeds.red)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle(`🗑️ Message Deleted`)
.addFields (
{ name: "📄 Result", value: `Deleted ${deleted} of ${total} messages.` }
Expand All @@ -69,7 +69,7 @@ module.exports = {

const log = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle(`🗑️ Message Deleted`)
.addFields (
{ name: "💬 Message", value: `${id}` },
Expand All @@ -86,7 +86,7 @@ module.exports = {
const message = new Discord.EmbedBuilder()
.setTimestamp(new Date(Number((BigInt(data._id) >> 22n) + 1420070400000n)))

if(user) message.setAuthor({ name: user.tag.endsWith("#0") ? `@${user.username}` : user.tag, iconURL: user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${user.id}` });
if(user) message.setAuthor({ name: user.tag.endsWith("#0") ? user.username : user.tag, iconURL: user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${user.id}` });
if(data.content) message.setDescription(data.content);
if(data.attachment) message.setImage(data.attachment);

Expand Down
4 changes: 2 additions & 2 deletions src/buttons/logs/message-ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = {
} catch {}

const banInfo = new Discord.EmbedBuilder()
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("Banned")
.addFields (
{ name: "❓ Reason", value: `${reason}` },
Expand All @@ -152,7 +152,7 @@ module.exports = {

const banLog = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("User Banned")
.addFields (
{ name: "👤 User", value: `${user}` },
Expand Down
4 changes: 2 additions & 2 deletions src/buttons/logs/report-ban.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ module.exports = {
} catch {}

const banInfo = new Discord.EmbedBuilder()
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("Banned")
.addFields (
{ name: "❓ Reason", value: `${reason}` },
Expand All @@ -152,7 +152,7 @@ module.exports = {

const banLog = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("User Banned")
.addFields (
{ name: "👤 User", value: `${user}` },
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/sentry/delete-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {

const deleted = new Discord.EmbedBuilder()
.setColor(client.config_embeds.red)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("🗑️ Deleted")
.setTimestamp()

Expand Down
2 changes: 1 addition & 1 deletion src/buttons/sentry/ignore-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {

const ignored = new Discord.EmbedBuilder()
.setColor(client.config_embeds.gray)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("🔕 Ignored")
.setTimestamp()

Expand Down
2 changes: 1 addition & 1 deletion src/buttons/sentry/resolve-issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {

const resolved = new Discord.EmbedBuilder()
.setColor(client.config_embeds.green)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("✅ Resolved")
.setTimestamp()

Expand Down
2 changes: 1 addition & 1 deletion src/buttons/suggestions/approve.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {

const approved = new Discord.EmbedBuilder()
.setColor(client.config_embeds.green)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("✅ Approved")
.setDescription(`${reason}`)
.setTimestamp()
Expand Down
2 changes: 1 addition & 1 deletion src/buttons/suggestions/deny.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = {

const denied = new Discord.EmbedBuilder()
.setColor(client.config_embeds.red)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? interaction.user.username : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("❌ Denied")
.setDescription(`${reason}`)
.setTimestamp()
Expand Down
Loading

0 comments on commit a046fd7

Please sign in to comment.