aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-07 20:15:45 -0400
committerIRONM00N <64110067+IRONM00N@users.noreply.github.com>2021-09-07 20:15:45 -0400
commit35d03eb54fe81c1d5c0359db67455b82f754e3f4 (patch)
tree5666ac26f6fee5e06c2c3a523fced614cb6723bf /src/commands
parent198aeadfc73642498afcb1eb637e0de86ccc9308 (diff)
downloadtanzanite-35d03eb54fe81c1d5c0359db67455b82f754e3f4.tar.gz
tanzanite-35d03eb54fe81c1d5c0359db67455b82f754e3f4.tar.bz2
tanzanite-35d03eb54fe81c1d5c0359db67455b82f754e3f4.zip
add owner bypasses and prevent blacklisted users from having their dms logged
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/admin/roleAll.ts2
-rw-r--r--src/commands/config/config.ts2
-rw-r--r--src/commands/moderation/ban.ts4
-rw-r--r--src/commands/moderation/kick.ts2
-rw-r--r--src/commands/moderation/mute.ts2
-rw-r--r--src/commands/moderation/role.ts8
-rw-r--r--src/commands/moderation/unmute.ts2
-rw-r--r--src/commands/moderation/warn.ts2
-rw-r--r--src/commands/moulberry-bush/giveawayPing.ts4
9 files changed, 15 insertions, 13 deletions
diff --git a/src/commands/admin/roleAll.ts b/src/commands/admin/roleAll.ts
index 82d15f5..ca82ca8 100644
--- a/src/commands/admin/roleAll.ts
+++ b/src/commands/admin/roleAll.ts
@@ -36,7 +36,7 @@ export default class RoleAllCommand extends BushCommand {
public override async exec(message: BushMessage, args: { role: Role; bot?: boolean }): Promise<unknown> {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be run in a server.`);
- if (!message.member!.permissions.has('ADMINISTRATOR'))
+ if (!message.member!.permissions.has('ADMINISTRATOR') && !message.member!.user.isOwner())
return await message.util.reply(`${util.emojis.error} You must have admin perms to use this command.`);
if (args.role.comparePositionTo(message.guild.me!.roles.highest) >= 0 && !args.role) {
diff --git a/src/commands/config/config.ts b/src/commands/config/config.ts
index ac3198b..6e7373c 100644
--- a/src/commands/config/config.ts
+++ b/src/commands/config/config.ts
@@ -190,7 +190,7 @@ export default class SettingsCommand extends BushCommand {
}
): Promise<unknown> {
if (!message.guild) return await message.util.reply(`${util.emojis.error} This command can only be used in servers.`);
- if (!message.member?.permissions.has('MANAGE_GUILD'))
+ if (!message.member?.permissions.has('MANAGE_GUILD') && !message.member?.user.isOwner())
return await message.util.reply(
`${util.emojis.error} You must have the **MANAGE_GUILD** permission to run this command.`
);
diff --git a/src/commands/moderation/ban.ts b/src/commands/moderation/ban.ts
index 812d7ca..fea5543 100644
--- a/src/commands/moderation/ban.ts
+++ b/src/commands/moderation/ban.ts
@@ -122,14 +122,14 @@ export default class BanCommand extends BushCommand {
const responseCode = member
? await member.bushBan({
reason: parsedReason,
- moderator: message.author,
+ moderator: message.member,
duration: time! ?? 0,
deleteDays: days ?? 0
})
: await message.guild.bushBan({
user,
reason: parsedReason,
- moderator: message.author,
+ moderator: message.member,
duration: time! ?? 0,
deleteDays: days ?? 0
});
diff --git a/src/commands/moderation/kick.ts b/src/commands/moderation/kick.ts
index e7f9708..07c25ab 100644
--- a/src/commands/moderation/kick.ts
+++ b/src/commands/moderation/kick.ts
@@ -75,7 +75,7 @@ export default class KickCommand extends BushCommand {
const responseCode = await member.bushKick({
reason,
- moderator: message.author
+ moderator: message.member
});
const responseMessage = () => {
diff --git a/src/commands/moderation/mute.ts b/src/commands/moderation/mute.ts
index 849873e..fba548b 100644
--- a/src/commands/moderation/mute.ts
+++ b/src/commands/moderation/mute.ts
@@ -86,7 +86,7 @@ export default class MuteCommand extends BushCommand {
const responseCode = await member.mute({
reason: parsedReason,
- moderator: message.author,
+ moderator: message.member,
duration: time! ?? 0
});
diff --git a/src/commands/moderation/role.ts b/src/commands/moderation/role.ts
index 15af014..d0abb54 100644
--- a/src/commands/moderation/role.ts
+++ b/src/commands/moderation/role.ts
@@ -97,7 +97,11 @@ export default class RoleCommand extends BushCommand {
message: BushMessage | BushSlashMessage,
{ action, user, role, duration }: { action: 'add' | 'remove'; user: BushGuildMember; role: BushRole; duration?: number }
): Promise<unknown> {
- if (!message.member!.permissions.has('MANAGE_ROLES')) {
+ if (
+ !message.member!.permissions.has('MANAGE_ROLES') &&
+ message.member!.id !== message.guild?.ownerId &&
+ !message.member!.user.isOwner()
+ ) {
const mappings = client.consts.mappings;
let mappedRole: { name: string; id: string };
for (let i = 0; i < mappings.roleMap.length; i++) {
@@ -134,8 +138,6 @@ export default class RoleCommand extends BushCommand {
const responseMessage = () => {
switch (responseCode) {
case 'user hierarchy':
- client.console.debug(role.position);
- client.console.debug(user.roles.highest.position);
return `${util.emojis.error} <@&${role.id}> is higher or equal to your highest role.`;
case 'role managed':
return `${util.emojis.error} <@&${role.id}> is managed by an integration and cannot be managed.`;
diff --git a/src/commands/moderation/unmute.ts b/src/commands/moderation/unmute.ts
index 3383583..ee4bebe 100644
--- a/src/commands/moderation/unmute.ts
+++ b/src/commands/moderation/unmute.ts
@@ -77,7 +77,7 @@ export default class UnmuteCommand extends BushCommand {
const responseCode = await member.unmute({
reason,
- moderator: message.author
+ moderator: message.member
});
const responseMessage = async () => {
diff --git a/src/commands/moderation/warn.ts b/src/commands/moderation/warn.ts
index 0fa83f3..44f4f5a 100644
--- a/src/commands/moderation/warn.ts
+++ b/src/commands/moderation/warn.ts
@@ -71,7 +71,7 @@ export default class WarnCommand extends BushCommand {
const { result: response, caseNum } = await member.warn({
reason,
- moderator: message.author
+ moderator: message.member
});
switch (response) {
diff --git a/src/commands/moulberry-bush/giveawayPing.ts b/src/commands/moulberry-bush/giveawayPing.ts
index 4caaf0c..4b96e07 100644
--- a/src/commands/moulberry-bush/giveawayPing.ts
+++ b/src/commands/moulberry-bush/giveawayPing.ts
@@ -24,8 +24,8 @@ export default class GiveawayPingCommand extends BushCommand {
}
public override async exec(message: BushMessage): Promise<unknown> {
- if (!message.member!.permissions.has('MANAGE_GUILD'))
- await message.util.reply(`${util.emojis.error} You are missing the \`manage server\` permission.`);
+ if (!message.member!.permissions.has('MANAGE_GUILD') && !message.member!.user.isOwner())
+ await message.util.reply(`${util.emojis.error} You are missing the **MANAGE_GUILD** permission.`);
await message.delete().catch(() => {});