diff options
author | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-20 23:07:02 -0400 |
---|---|---|
committer | IRONM00N <64110067+IRONM00N@users.noreply.github.com> | 2022-08-20 23:07:02 -0400 |
commit | b81f9e8b73cb520ad5ae916c3e571ea55f4ca489 (patch) | |
tree | 25d7f42d66c3e3190022ece043c86082a9e85709 /lib/utils/FormatResponse.ts | |
parent | f2e5cfff7dc275bd93fac446a508b7d18ecd6c58 (diff) | |
download | tanzanite-b81f9e8b73cb520ad5ae916c3e571ea55f4ca489.tar.gz tanzanite-b81f9e8b73cb520ad5ae916c3e571ea55f4ca489.tar.bz2 tanzanite-b81f9e8b73cb520ad5ae916c3e571ea55f4ca489.zip |
fix ts composite shit, replace got with native fetch, update deps
Diffstat (limited to 'lib/utils/FormatResponse.ts')
-rw-r--r-- | lib/utils/FormatResponse.ts | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/lib/utils/FormatResponse.ts b/lib/utils/FormatResponse.ts new file mode 100644 index 0000000..f094601 --- /dev/null +++ b/lib/utils/FormatResponse.ts @@ -0,0 +1,32 @@ +import type { GuildMember } from 'discord.js'; +import { unmuteResponse, UnmuteResponse } from '../extensions/discord.js/ExtendedGuildMember.js'; +import { emojis } from './BushConstants.js'; +import { format } from './BushUtils.js'; +import { input } from './Format.js'; + +export function formatUnmuteResponse(prefix: string, member: GuildMember, code: UnmuteResponse): string { + const error = emojis.error; + const victim = input(member.user.tag); + switch (code) { + case unmuteResponse.MISSING_PERMISSIONS: + return `${error} Could not unmute ${victim} because I am missing the **Manage Roles** permission.`; + case unmuteResponse.NO_MUTE_ROLE: + return `${error} Could not unmute ${victim}, you must set a mute role with \`${prefix}config muteRole\`.`; + case unmuteResponse.MUTE_ROLE_INVALID: + return `${error} Could not unmute ${victim} because the current mute role no longer exists. Please set a new mute role with \`${prefix}config muteRole\`.`; + case unmuteResponse.MUTE_ROLE_NOT_MANAGEABLE: + return `${error} Could not unmute ${victim} because I cannot assign the current mute role, either change the role's position or set a new mute role with \`${prefix}config muteRole\`.`; + case unmuteResponse.ACTION_ERROR: + return `${error} Could not unmute ${victim}, there was an error removing their mute role.`; + case unmuteResponse.MODLOG_ERROR: + return `${error} While muting ${victim}, there was an error creating a modlog entry, please report this to my developers.`; + case unmuteResponse.PUNISHMENT_ENTRY_REMOVE_ERROR: + return `${error} While muting ${victim}, there was an error removing their mute entry, please report this to my developers.`; + case unmuteResponse.DM_ERROR: + return `${emojis.warn} unmuted ${victim} however I could not send them a dm.`; + case unmuteResponse.SUCCESS: + return `${emojis.success} Successfully unmuted ${victim}.`; + default: + return `${emojis.error} An error occurred: ${format.input(code)}}`; + } +} |