aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/dev/eval.ts2
-rw-r--r--src/commands/info/avatar.ts3
-rw-r--r--src/commands/info/guildInfo.ts57
-rw-r--r--src/commands/info/userInfo.ts18
-rw-r--r--src/commands/moderation/slowmode.ts21
-rw-r--r--src/commands/skyblock-reborn/chooseColor.ts (renamed from src/commands/skyblock-reborn/chooseColorCommand.ts)4
6 files changed, 62 insertions, 43 deletions
diff --git a/src/commands/dev/eval.ts b/src/commands/dev/eval.ts
index abdf2b9..4f6a293 100644
--- a/src/commands/dev/eval.ts
+++ b/src/commands/dev/eval.ts
@@ -86,10 +86,8 @@ export default class EvalCommand extends BushCommand {
config = client.config,
members = message.guild?.members,
roles = message.guild?.roles,
- client = client,
emojis = util.emojis,
colors = util.colors,
- util = util,
{ ActivePunishment, Global, Guild, Level, ModLog, StickyRole } = await import('@lib'),
{
ButtonInteraction,
diff --git a/src/commands/info/avatar.ts b/src/commands/info/avatar.ts
index dc10f7d..4f7449b 100644
--- a/src/commands/info/avatar.ts
+++ b/src/commands/info/avatar.ts
@@ -43,9 +43,8 @@ export default class AvatarCommand extends BushCommand {
const embed = new MessageEmbed()
.setTimestamp()
.setColor(util.colors.default)
- .setTitle(user.tag)
+ .setTitle(`${user.tag}'s Avatar`)
.setImage(user.avatarURL({ size: 2048, format: 'png', dynamic: true }));
-
await message.util.reply({ embeds: [embed] });
}
}
diff --git a/src/commands/info/guildInfo.ts b/src/commands/info/guildInfo.ts
index e82a5fe..577086b 100644
--- a/src/commands/info/guildInfo.ts
+++ b/src/commands/info/guildInfo.ts
@@ -1,8 +1,7 @@
import { Argument, Constants } from 'discord-akairo';
-import { Guild, GuildPreview, MessageEmbed, Snowflake, Vanity } from 'discord.js';
+import { BaseGuildVoiceChannel, Guild, GuildPreview, MessageEmbed, Snowflake, Vanity } from 'discord.js';
import { BushCommand, BushMessage, BushSlashMessage } from '../../lib';
-// TODO: Implement regions and security
export default class GuildInfoCommand extends BushCommand {
public constructor() {
super('guildInfo', {
@@ -58,9 +57,9 @@ export default class GuildInfoCommand extends BushCommand {
const guild: Guild | GuildPreview = (args?.guild as Guild | GuildPreview) || (message.guild as Guild);
const emojis: string[] = [];
const guildAbout: string[] = [];
- // const guildSecurity = [];
- if (['516977525906341928', '784597260465995796', '717176538717749358', '767448775450820639'].includes(guild.id))
- emojis.push(client.consts.mappings.otherEmojis.BUSH_VERIFIED);
+ const guildSecurity = [];
+ const verifiedGuilds = Object.values(client.consts.mappings.guilds);
+ if (verifiedGuilds.includes(guild.id)) emojis.push(client.consts.mappings.otherEmojis.BUSH_VERIFIED);
if (!isPreview && guild instanceof Guild) {
if (guild.premiumTier) emojis.push(client.consts.mappings.otherEmojis['BOOST_' + guild.premiumTier]);
@@ -91,21 +90,29 @@ export default class GuildInfoCommand extends BushCommand {
.size.toLocaleString()}`
];
- // TODO add guild regions
- // const guildRegions = [];
+ const guildRegions = [];
+ guild.channels.cache.forEach((channel) => {
+ if (!channel.type.includes('VOICE')) return;
+ else if (!guildRegions.includes((channel as BaseGuildVoiceChannel).rtcRegion ?? 'automatic')) {
+ guildRegions.push((channel as BaseGuildVoiceChannel).rtcRegion ?? 'automatic');
+ }
+ });
guildAbout.push(
`**Owner:** ${guild.members.cache.get(guild.ownerId)?.user.tag}`,
- `**Created** ${guild.createdAt.toLocaleString()}`,
- `**Members:** ${guild.memberCount.toLocaleString()}`,
- `**Online:** ${guild.approximatePresenceCount?.toLocaleString()}`,
- `**Channels:** ${guild.channels.cache.size} (${channelTypes.join(', ')})`,
- `**Emojis:** ${guild.emojis.cache.size.toLocaleString()}`
- // `**Region:** ${guildRegions.join()}`
+ `**Created** ${guild.createdAt.toLocaleString()} (${util.dateDelta(guild.createdAt)})`,
+ `**Members:** ${guild.memberCount.toLocaleString() ?? 0}`,
+ `**Online:** ${guild.approximatePresenceCount?.toLocaleString() ?? 0}`,
+ `**Channels:** ${guild.channels.cache.size?.toLocaleString() ?? 0} (${channelTypes.join(', ')})`,
+ `**Emojis:** ${guild.emojis.cache.size?.toLocaleString() ?? 0}`,
+ `**Stickers:** ${guild.stickers.cache.size?.toLocaleString() ?? 0}`,
+ `**Regions:** ${guildRegions.map((region) => client.consts.mappings.regions[region] || region).join(', ')}`
);
if (guild.premiumSubscriptionCount)
guildAbout.push(
- `**Boosts:** Level ${guild.premiumTier.slice(0, 4)} with ${guild.premiumSubscriptionCount ?? 0} boosts`
+ `**Boosts:** Level ${guild.premiumTier == 'NONE' ? '0' : guild.premiumTier[5]} with ${
+ guild.premiumSubscriptionCount ?? 0
+ } boosts`
);
if (guild.me?.permissions.has('MANAGE_GUILD') && guild.vanityURLCode) {
const vanityInfo: Vanity = await guild.fetchVanityData();
@@ -115,12 +122,22 @@ export default class GuildInfoCommand extends BushCommand {
);
}
- // guildSecurity.push;
+ guildSecurity.push(
+ `**Verification Level**: ${guild.verificationLevel.toLowerCase().replace(/_/g, ' ')}`,
+ `**Explicit Content Filter:** ${guild.explicitContentFilter.toLowerCase().replace(/_/g, ' ')}`,
+ `**Default Message Notifications:** ${
+ typeof guild.defaultMessageNotifications === 'string'
+ ? guild.defaultMessageNotifications.toLowerCase().replace(/_/g, ' ')
+ : guild.defaultMessageNotifications
+ }`,
+ `**2FA Required**: ${guild.mfaLevel === 'ELEVATED' ? 'yes' : 'no'}`
+ );
} else {
guildAbout.push(
`**Members:** ${guild.approximateMemberCount?.toLocaleString()}`,
`**Online:** ${guild.approximatePresenceCount?.toLocaleString()}`,
- `**Emojis:** ${(guild as GuildPreview).emojis.size}`
+ `**Emojis:** ${(guild as GuildPreview).emojis.size?.toLocaleString() ?? 0}`
+ // `**Stickers:** ${(guild as GuildPreview).stickers.size}`
);
}
@@ -160,11 +177,11 @@ export default class GuildInfoCommand extends BushCommand {
if (guildIcon) {
guildInfoEmbed.setThumbnail(guildIcon);
}
- // if (!isPreview) {
- // guildInfoEmbed.addField('» Security', guildSecurity.join('\n'));
- // }
+ if (!isPreview) {
+ guildInfoEmbed.addField('» Security', guildSecurity.join('\n'));
+ }
if (emojis) {
- guildInfoEmbed.setDescription(emojis.join(' '));
+ guildInfoEmbed.setDescription('\u200B' /*zero width space*/ + emojis.join(' '));
}
return await message.util.reply({ embeds: [guildInfoEmbed] });
}
diff --git a/src/commands/info/userInfo.ts b/src/commands/info/userInfo.ts
index 87235a9..e36e92b 100644
--- a/src/commands/info/userInfo.ts
+++ b/src/commands/info/userInfo.ts
@@ -1,6 +1,5 @@
import { BushCommand, BushMessage, BushSlashMessage } from '@lib';
import { GuildMember, MessageEmbed } from 'discord.js';
-import moment from 'moment';
// TODO: Allow looking up a user not in the guild and not cached
// TODO: Re-Implement Status Emojis
@@ -78,11 +77,11 @@ export default class UserInfoCommand extends BushCommand {
if (user.premiumSinceTimestamp) emojis.push(client.consts.mappings.otherEmojis.BOOSTER);
const createdAt = user.user.createdAt.toLocaleString(),
- createdAtDelta = moment(moment(user.user.createdAt).diff(moment())).toLocaleString(),
+ createdAtDelta = util.dateDelta(user.user.createdAt),
joinedAt = user.joinedAt?.toLocaleString(),
- joinedAtDelta = moment(user.joinedAt)?.diff(moment()).toLocaleString(),
+ joinedAtDelta = util.dateDelta(user.joinedAt, 2),
premiumSince = user.premiumSince?.toLocaleString(),
- premiumSinceDelta = moment(user.premiumSince)?.diff(moment()).toLocaleString();
+ premiumSinceDelta = util.dateDelta(user.premiumSince, 2);
// General Info
const generalInfo = [
@@ -101,12 +100,12 @@ export default class UserInfoCommand extends BushCommand {
if (premiumSince) serverUserInfo.push(`**Boosting Since:** ${premiumSince} (${premiumSinceDelta} ago)`);
if (user.displayHexColor) serverUserInfo.push(`**Display Color:** ${user.displayHexColor}`);
if (user.id == '322862723090219008' && message.guild.id == client.consts.mappings.guilds.bush)
- serverUserInfo.push(`**General Deletions:** 2`);
+ serverUserInfo.push(`**General Deletions:** 1⅓`);
if (
['384620942577369088', '496409778822709251'].includes(user.id) &&
message.guild.id == client.consts.mappings.guilds.bush
)
- serverUserInfo.push(`**General Deletions:** 1`);
+ serverUserInfo.push(`**General Deletions:** ⅓`);
if (user.nickname) serverUserInfo.push(`**Nickname** ${user.nickname}`);
if (serverUserInfo.length)
userEmbed.addField('» Server Info', serverUserInfo.join('\n')).setColor(user.displayColor || util.colors.default);
@@ -128,10 +127,11 @@ export default class UserInfoCommand extends BushCommand {
if (user.presence.clientStatus) devices = Object.keys(user.presence.clientStatus);
const presenceInfo = [];
if (user.presence.status) presenceInfo.push(`**Status:** ${user.presence.status}`);
- if (devices) presenceInfo.push(`**${devices.length - 1 ? 'Devices' : 'Device'}:** ${util.oxford(devices, 'and', '')}`);
+ if (devices && devices.length)
+ presenceInfo.push(`**${devices.length - 1 ? 'Devices' : 'Device'}:** ${util.oxford(devices, 'and', '')}`);
if (activitiesNames.length)
presenceInfo.push(`**Activit${activitiesNames.length - 1 ? 'ies' : 'y'}:** ${util.oxford(activitiesNames, 'and', '')}`);
- if (customStatus) presenceInfo.push(`**Custom Status:** ${customStatus}`);
+ if (customStatus && customStatus.length) presenceInfo.push(`**Custom Status:** ${customStatus}`);
userEmbed.addField('» Presence', presenceInfo.join('\n'));
}
@@ -148,7 +148,7 @@ export default class UserInfoCommand extends BushCommand {
}
if (perms.length) userEmbed.addField('» Important Perms', perms.join(' '));
- if (emojis) userEmbed.setDescription('​' /*zero width space*/ + emojis.join(' '));
+ if (emojis) userEmbed.setDescription('\u200B' /*zero width space*/ + emojis.join(' '));
return await message.util.reply({ embeds: [userEmbed] });
}
diff --git a/src/commands/moderation/slowmode.ts b/src/commands/moderation/slowmode.ts
index f9ffbab..9b0d300 100644
--- a/src/commands/moderation/slowmode.ts
+++ b/src/commands/moderation/slowmode.ts
@@ -1,6 +1,6 @@
-import { BushCommand, BushMessage, BushSlashMessage } from '@lib';
-import { Argument, Constants } from 'discord-akairo';
-import { TextChannel, ThreadChannel } from 'discord.js';
+import { BushCommand, BushMessage, BushNewsChannel, BushSlashMessage, BushTextChannel, BushThreadChannel } from '@lib';
+import { Argument } from 'discord-akairo';
+import { NewsChannel, TextChannel, ThreadChannel } from 'discord.js';
export default class SlowModeCommand extends BushCommand {
public constructor() {
@@ -25,8 +25,7 @@ export default class SlowModeCommand extends BushCommand {
},
{
id: 'channel',
- type: Constants.ArgumentTypes.CHANNEL,
- match: Constants.ArgumentMatches.PHRASE,
+ type: 'channel',
prompt: {
start: 'What channel would you like to change?',
retry: '{error} Choose a valid channel.',
@@ -51,12 +50,18 @@ export default class SlowModeCommand extends BushCommand {
public async exec(
message: BushMessage | BushSlashMessage,
- { length, channel }: { length: number | 'off' | 'none' | 'disable'; channel: TextChannel | ThreadChannel }
+ {
+ length,
+ channel
+ }: {
+ length: number | 'off' | 'none' | 'disable';
+ channel: TextChannel | ThreadChannel | BushTextChannel | BushNewsChannel | BushThreadChannel | NewsChannel;
+ }
): Promise<unknown> {
if (message.channel.type === 'DM')
return await message.util.reply(`${util.emojis.error} This command cannot be run in dms.`);
- if (!channel) channel = message.channel as ThreadChannel | TextChannel;
- if (!(channel instanceof TextChannel) || !(channel instanceof ThreadChannel))
+ if (!channel) channel = message.channel;
+ if (!(channel instanceof TextChannel) && !(channel instanceof ThreadChannel))
return await message.util.reply(`${util.emojis.error} <#${channel.id}> is not a text or thread channel.`);
if (length) {
length =
diff --git a/src/commands/skyblock-reborn/chooseColorCommand.ts b/src/commands/skyblock-reborn/chooseColor.ts
index 0138e36..2b72301 100644
--- a/src/commands/skyblock-reborn/chooseColorCommand.ts
+++ b/src/commands/skyblock-reborn/chooseColor.ts
@@ -93,7 +93,7 @@ export default class ChooseColorCommand extends BushCommand {
args: [
{
id: 'color',
- type: Constants.ArgumentTypes.ROLE,
+ type: 'role',
match: Constants.ArgumentMatches.REST,
prompt: {
start: 'Please choose a valid color.',
@@ -102,7 +102,7 @@ export default class ChooseColorCommand extends BushCommand {
}
}
],
- clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'],
+ clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES', 'MANAGE_ROLES'],
channel: 'guild',
restrictedGuilds: ['839287012409999391'],
slash: true,