aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-01 22:19:41 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-01 22:19:41 -0400
commit560ed31860a420dcc43571d2e12dd2f51bcee7a8 (patch)
tree855e0cb50c550bbff63ab675e1102b7608573668 /src/commands
parent855aa36c46e250fd3063eb200d784903a8c388d3 (diff)
downloadtanzanite-560ed31860a420dcc43571d2e12dd2f51bcee7a8.tar.gz
tanzanite-560ed31860a420dcc43571d2e12dd2f51bcee7a8.tar.bz2
tanzanite-560ed31860a420dcc43571d2e12dd2f51bcee7a8.zip
cleanup
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/admin/channelPermissions.ts2
-rw-r--r--src/commands/admin/roleAll.ts11
-rw-r--r--src/commands/dev/__template.ts2
-rw-r--r--src/commands/dev/test.ts39
-rw-r--r--src/commands/info/color.ts9
-rw-r--r--src/commands/leveling/level.ts6
-rw-r--r--src/commands/leveling/setLevel.ts (renamed from src/commands/dev/setLevel.ts)7
-rw-r--r--src/commands/moderation/_lockdown.ts3
-rw-r--r--src/commands/moulberry-bush/capes.ts12
-rw-r--r--src/commands/moulberry-bush/moulHammer.ts (renamed from src/commands/moulberry-bush/moulHammerCommand.ts)0
10 files changed, 43 insertions, 48 deletions
diff --git a/src/commands/admin/channelPermissions.ts b/src/commands/admin/channelPermissions.ts
index ea97343..3b8c157 100644
--- a/src/commands/admin/channelPermissions.ts
+++ b/src/commands/admin/channelPermissions.ts
@@ -71,7 +71,7 @@ export default class ChannelPermissionsCommand extends BushCommand {
await channel.permissionOverwrites.create(
target.id,
{ [permission]: permissionState },
- { reason: 'Changing overwrites for mass channel channel perms command' }
+ { reason: 'Changing overwrites for mass channel perms command' }
);
} catch (e) {
client.console.debug(e.stack);
diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts
index 2382a4b..7e60f40 100644
--- a/src/commands/admin/roleAll.ts
+++ b/src/commands/admin/roleAll.ts
@@ -5,7 +5,7 @@ export default class RoleAllCommand extends BushCommand {
public constructor() {
super('roleAll', {
aliases: ['roleall', 'rall'],
- category: 'Server Admin',
+ category: 'admin',
description: {
content: 'Give a role to every member on the server.',
usage: 'roleAll <role> [another role]... [--bots]',
@@ -45,11 +45,8 @@ export default class RoleAllCommand extends BushCommand {
);
}
- console.time('roleAll1');
let members = await message.guild.members.fetch();
- console.timeEnd('roleAll1');
- console.time('roleAll2');
members = members.filter((member: GuildMember) => {
try {
if (member.user.bot && !args.bot) return false;
@@ -59,21 +56,15 @@ export default class RoleAllCommand extends BushCommand {
}
return true;
});
- console.timeEnd('roleAll2');
- console.time('roleAll3');
await message.util.reply(`${this.client.util.emojis.loading} adding roles to ${members.size} members`);
console.timeEnd('roleAll3');
- console.time('roleAll4');
const promises = members.map((member: GuildMember) => {
return member.roles.add(args.role, `RoleAll Command - triggered by ${message.author.tag} (${message.author.id})`);
});
- console.timeEnd('roleAll4');
- console.time('roleAll5');
const failed = (await Promise.allSettled(promises)).filter((val) => val.status === 'rejected');
- console.timeEnd('roleAll5');
if (!failed.length) {
await message.util.reply({
diff --git a/src/commands/dev/__template.ts b/src/commands/dev/__template.ts
index 4cf407c..49549af 100644
--- a/src/commands/dev/__template.ts
+++ b/src/commands/dev/__template.ts
@@ -56,7 +56,7 @@ export default class TemplateCommand extends BushCommand {
public override async exec(
message: BushMessage | BushSlashMessage,
- args: { required_argument: string; optional_argumen: string }
+ args: { required_argument: string; optional_argument: string }
): Promise<unknown> {
return await message.util.reply(`${util.emojis.error} Do not use the template command.`);
args;
diff --git a/src/commands/dev/test.ts b/src/commands/dev/test.ts
index bb0807b..104861f 100644
--- a/src/commands/dev/test.ts
+++ b/src/commands/dev/test.ts
@@ -1,5 +1,12 @@
import { BushCommand, BushMessage } from '@lib';
-import { Constants as jsConstants, MessageActionRow, MessageButton, MessageEmbed } from 'discord.js';
+import {
+ ApplicationCommand,
+ Collection,
+ Constants as jsConstants,
+ MessageActionRow,
+ MessageButton,
+ MessageEmbed
+} from 'discord.js';
export default class TestCommand extends BushCommand {
public constructor() {
@@ -126,28 +133,18 @@ export default class TestCommand extends BushCommand {
}
return await message.util.reply({ content: 'this is content', components: ButtonRows, embeds });
} else if (['delete slash commands'].includes(args?.feature?.toLowerCase())) {
- // let guildCommandCount = 0;
- // client.guilds.cache.forEach(guild =>
- // guild.commands.fetch().then(commands => {
- // commands.forEach(async command => {
- // await command.delete();
- // guildCommandCount++;
- // });
- // })
- // );
if (!message.guild) return await message.util.reply(`${util.emojis.error} This test can only be run in a guild.`);
- const guildCommands = await message.guild.commands.fetch();
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
- guildCommands.forEach(async (command) => await command.delete());
- const globalCommands = await client.application!.commands.fetch();
- // eslint-disable-next-line @typescript-eslint/no-misused-promises
- globalCommands.forEach(async (command) => await command.delete());
+ await client.guilds.fetch();
+ const promises: Promise<Collection<string, ApplicationCommand>>[] = [];
+ client.guilds.cache.each((guild) => {
+ promises.push(guild.commands.set([]));
+ });
+ await Promise.all(promises);
- return await message.util.reply(
- `${util.emojis.success} Removed **${/* guildCommandCount */ guildCommands.size}** guild commands and **${
- globalCommands.size
- }** global commands.`
- );
+ await client.application!.commands.fetch();
+ await client.application!.commands.set([]);
+
+ return await message.util.reply(`${util.emojis.success} Removed guild commands and global commands.`);
} else if (['drop down', 'drop downs', 'select menu', 'select menus'].includes(args?.feature?.toLowerCase())) {
}
return await message.util.reply(responses[Math.floor(Math.random() * responses.length)]);
diff --git a/src/commands/info/color.ts b/src/commands/info/color.ts
index 350c23d..5268516 100644
--- a/src/commands/info/color.ts
+++ b/src/commands/info/color.ts
@@ -1,13 +1,13 @@
import { AllowedMentions, BushCommand, BushGuildMember, BushMessage, BushRole, BushSlashMessage } from '@lib';
import { Argument } from 'discord-akairo';
import { Message, MessageEmbed, Role } from 'discord.js';
-import { Constructor } from 'tinycolor2';
+import tinycolor from 'tinycolor2'; // this is the only way I got it to work consistently
-// eslint-disable-next-line @typescript-eslint/no-var-requires
-const tinycolor: Constructor = require('tinycolor2'); // this is the only way I got it to work consistently
const isValidTinyColor = (_message: Message, phase: string) => {
+ console.dir(phase);
// if the phase is a number it converts it to hex incase it could be representing a color in decimal
- const newPhase = Number.isNaN(phase) ? phase : `#${Number(phase).toString(16)}`;
+ const newPhase = isNaN(phase as any) ? phase : `#${Number(phase).toString(16)}`;
+ console.dir(newPhase);
return tinycolor(newPhase).isValid() ? newPhase : null;
};
@@ -25,6 +25,7 @@ export default class ColorCommand extends BushCommand {
{
id: 'color',
customType: Argument.union(isValidTinyColor, 'role', 'member'),
+ match: 'restContent',
prompt: {
start: 'What color code, role, or user would you like to find the color of?',
retry: '{error} Choose a valid color, role, or member.'
diff --git a/src/commands/leveling/level.ts b/src/commands/leveling/level.ts
index f22ed8d..223a590 100644
--- a/src/commands/leveling/level.ts
+++ b/src/commands/leveling/level.ts
@@ -35,6 +35,7 @@ export default class LevelCommand extends BushCommand {
}
}
],
+ slash: true,
slashOptions: [
{
name: 'user',
@@ -43,8 +44,9 @@ export default class LevelCommand extends BushCommand {
required: false
}
],
- slash: true,
- channel: 'guild'
+ channel: 'guild',
+ clientPermissions: ['SEND_MESSAGES'],
+ userPermissions: ['SEND_MESSAGES']
});
}
diff --git a/src/commands/dev/setLevel.ts b/src/commands/leveling/setLevel.ts
index 777ef60..be3700a 100644
--- a/src/commands/dev/setLevel.ts
+++ b/src/commands/leveling/setLevel.ts
@@ -5,7 +5,7 @@ export default class SetLevelCommand extends BushCommand {
public constructor() {
super('setlevel', {
aliases: ['setlevel'],
- category: 'dev',
+ category: 'leveling',
description: {
content: 'Sets the level of a user',
usage: 'setlevel <user> <level>',
@@ -43,9 +43,10 @@ export default class SetLevelCommand extends BushCommand {
required: true
}
],
- ownerOnly: true,
slash: true,
- channel: 'guild'
+ channel: 'guild',
+ clientPermissions: ['SEND_MESSAGES'],
+ userPermissions: ['SEND_MESSAGES', 'ADMINISTRATOR']
});
}
diff --git a/src/commands/moderation/_lockdown.ts b/src/commands/moderation/_lockdown.ts
index b7bf4b2..68197df 100644
--- a/src/commands/moderation/_lockdown.ts
+++ b/src/commands/moderation/_lockdown.ts
@@ -28,7 +28,8 @@ export default class LockdownCommand extends BushCommand {
],
channel: 'guild',
clientPermissions: ['SEND_MESSAGES'],
- userPermissions: ['SEND_MESSAGES']
+ userPermissions: ['SEND_MESSAGES'],
+ hidden: true
});
}
diff --git a/src/commands/moulberry-bush/capes.ts b/src/commands/moulberry-bush/capes.ts
index c8d1a05..447d604 100644
--- a/src/commands/moulberry-bush/capes.ts
+++ b/src/commands/moulberry-bush/capes.ts
@@ -49,7 +49,6 @@ export default class CapesCommand extends BushCommand {
default: null
}
],
- clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'],
slash: true,
slashOptions: [
{
@@ -58,7 +57,9 @@ export default class CapesCommand extends BushCommand {
type: 'STRING',
required: false
}
- ]
+ ],
+ clientPermissions: ['EMBED_LINKS', 'SEND_MESSAGES'],
+ userPermissions: ['SEND_MESSAGES']
});
}
@@ -73,17 +74,17 @@ export default class CapesCommand extends BushCommand {
}))
.filter((f) => f.match !== null);
- const capes1: { name: string; url: string; index: number }[] = [];
+ const capes1: { name: string; url: string; index: number; purchasable?: boolean }[] = [];
client.consts.mappings.capes.forEach((mapCape) => {
if (!capes.some((gitCape) => gitCape.match!.groups!.name === mapCape.name) && mapCape.custom) {
- capes1.push({ name: mapCape.name, url: mapCape.custom, index: mapCape.index });
+ capes1.push({ name: mapCape.name, url: mapCape.custom, index: mapCape.index, purchasable: mapCape.purchasable });
}
});
capes.forEach((gitCape) => {
const mapCape = client.consts.mappings.capes.find((a) => a.name === gitCape.match!.groups!.name);
const url = mapCape?.custom ?? `https://github.com/Moulberry/NotEnoughUpdates/raw/master/${gitCape.f.path}`;
const index = mapCape?.index !== undefined ? mapCape.index : null;
- capes1.push({ name: gitCape.match!.groups!.name, url, index: index! });
+ capes1.push({ name: gitCape.match!.groups!.name, url, index: index!, purchasable: mapCape?.purchasable });
});
const sortedCapes = capes1.sort((a, b) => {
@@ -123,6 +124,7 @@ export default class CapesCommand extends BushCommand {
color: util.colors.default
}).setTimestamp();
embed.setImage(capeObj.url);
+ if (capeObj.purchasable) embed.setDescription(':money_with_wings: **purchasable** :money_with_wings:');
embeds.push(embed);
}
await util.buttonPaginate(message, embeds, null);
diff --git a/src/commands/moulberry-bush/moulHammerCommand.ts b/src/commands/moulberry-bush/moulHammer.ts
index bc60372..bc60372 100644
--- a/src/commands/moulberry-bush/moulHammerCommand.ts
+++ b/src/commands/moulberry-bush/moulHammer.ts