import { Message , Permissions } from "discord.js" ; /**
 * A function that will halt execution if an error is thrown
 */ export type Inhibitor = ( message : Message ) => void | never ; param message export const noBots = ( message ) => { if ( message . author . bot ) { throw new Error ( "This command cannot be used by bots" ) ; } } ; param message export const guildsOnly = ( message ) => { if ( ! message . guild ) { throw new Error ( "This command can only be used in a server" ) ; } } ; param message export const guildAdminsOnly = ( message ) => { if ( ! message . guild ) { throw new Error ( "This command can only be used in a server" ) ; } if ( ! message . member ) { throw new Error ( "Could not find member of message" ) ; } if ( ! message . member . permissions . has ( Permissions . FLAGS . ADMINISTRATOR ) ) { throw new Error ( "You do not have permission to use this command" ) ; } } ; export const CommonInhibitors = { noBots , guildsOnly , guildAdminsOnly , } as const ;