buddy

node MVC discord bot
Log | Files | Refs | README

Messages.js (5390B)


      1 'use strict';
      2 
      3 const { register } = require('./DJSError');
      4 
      5 const Messages = {
      6   CLIENT_INVALID_OPTION: (prop, must) => `The ${prop} option must be ${must}`,
      7   CLIENT_INVALID_PROVIDED_SHARDS: 'None of the provided shards were valid.',
      8 
      9   TOKEN_INVALID: 'An invalid token was provided.',
     10   TOKEN_MISSING: 'Request to use token, but token was unavailable to the client.',
     11 
     12   WS_CLOSE_REQUESTED: 'WebSocket closed due to user request.',
     13   WS_CONNECTION_EXISTS: 'There is already an existing WebSocket connection.',
     14   WS_NOT_OPEN: (data = 'data') => `Websocket not open to send ${data}`,
     15 
     16   BITFIELD_INVALID: 'Invalid bitfield flag or number.',
     17 
     18   SHARDING_INVALID: 'Invalid shard settings were provided.',
     19   SHARDING_REQUIRED: 'This session would have handled too many guilds - Sharding is required.',
     20   INVALID_INTENTS: 'Invalid intent provided for WebSocket intents.',
     21   DISALLOWED_INTENTS: 'Privileged intent provided is not enabled or whitelisted.',
     22   SHARDING_NO_SHARDS: 'No shards have been spawned.',
     23   SHARDING_IN_PROCESS: 'Shards are still being spawned.',
     24   SHARDING_ALREADY_SPAWNED: count => `Already spawned ${count} shards.`,
     25   SHARDING_PROCESS_EXISTS: id => `Shard ${id} already has an active process.`,
     26   SHARDING_READY_TIMEOUT: id => `Shard ${id}'s Client took too long to become ready.`,
     27   SHARDING_READY_DISCONNECTED: id => `Shard ${id}'s Client disconnected before becoming ready.`,
     28   SHARDING_READY_DIED: id => `Shard ${id}'s process exited before its Client became ready.`,
     29 
     30   COLOR_RANGE: 'Color must be within the range 0 - 16777215 (0xFFFFFF).',
     31   COLOR_CONVERT: 'Unable to convert color to a number.',
     32 
     33   EMBED_FIELD_NAME: 'MessageEmbed field names may not be empty.',
     34   EMBED_FIELD_VALUE: 'MessageEmbed field values may not be empty.',
     35 
     36   FILE_NOT_FOUND: file => `File could not be found: ${file}`,
     37 
     38   USER_NO_DMCHANNEL: 'No DM Channel exists!',
     39 
     40   VOICE_INVALID_HEARTBEAT: 'Tried to set voice heartbeat but no valid interval was specified.',
     41   VOICE_USER_MISSING: "Couldn't resolve the user to create stream.",
     42   VOICE_JOIN_CHANNEL: (full = false) =>
     43     `You do not have permission to join this voice channel${full ? '; it is full.' : '.'}`,
     44   VOICE_CONNECTION_TIMEOUT: 'Connection not established within 15 seconds.',
     45   VOICE_TOKEN_ABSENT: 'Token not provided from voice server packet.',
     46   VOICE_SESSION_ABSENT: 'Session ID not supplied.',
     47   VOICE_INVALID_ENDPOINT: 'Invalid endpoint received.',
     48   VOICE_NO_BROWSER: 'Voice connections are not available in browsers.',
     49   VOICE_CONNECTION_ATTEMPTS_EXCEEDED: attempts => `Too many connection attempts (${attempts}).`,
     50   VOICE_JOIN_SOCKET_CLOSED: 'Tried to send join packet, but the WebSocket is not open.',
     51   VOICE_PLAY_INTERFACE_NO_BROADCAST: 'A broadcast cannot be played in this context.',
     52   VOICE_PLAY_INTERFACE_BAD_TYPE: 'Unknown stream type',
     53   VOICE_PRISM_DEMUXERS_NEED_STREAM: 'To play a webm/ogg stream, you need to pass a ReadableStream.',
     54 
     55   VOICE_STATE_UNCACHED_MEMBER: 'The member of this voice state is uncached.',
     56   VOICE_STATE_NOT_OWN: 'You cannot self-deafen/mute on VoiceStates that do not belong to the ClientUser.',
     57   VOICE_STATE_INVALID_TYPE: name => `${name} must be a boolean.`,
     58 
     59   UDP_SEND_FAIL: 'Tried to send a UDP packet, but there is no socket available.',
     60   UDP_ADDRESS_MALFORMED: 'Malformed UDP address or port.',
     61   UDP_CONNECTION_EXISTS: 'There is already an existing UDP connection.',
     62 
     63   REQ_RESOURCE_TYPE: 'The resource must be a string, Buffer or a valid file stream.',
     64 
     65   IMAGE_FORMAT: format => `Invalid image format: ${format}`,
     66   IMAGE_SIZE: size => `Invalid image size: ${size}`,
     67 
     68   MESSAGE_BULK_DELETE_TYPE: 'The messages must be an Array, Collection, or number.',
     69   MESSAGE_NONCE_TYPE: 'Message nonce must fit in an unsigned 64-bit integer.',
     70 
     71   TYPING_COUNT: 'Count must be at least 1',
     72 
     73   SPLIT_MAX_LEN: 'Chunk exceeds the max length and contains no split characters.',
     74 
     75   BAN_RESOLVE_ID: (ban = false) => `Couldn't resolve the user ID to ${ban ? 'ban' : 'unban'}.`,
     76   FETCH_BAN_RESOLVE_ID: "Couldn't resolve the user ID to fetch the ban.",
     77 
     78   PRUNE_DAYS_TYPE: 'Days must be a number',
     79 
     80   GUILD_CHANNEL_RESOLVE: 'Could not resolve channel to a guild channel.',
     81   GUILD_VOICE_CHANNEL_RESOLVE: 'Could not resolve channel to a guild voice channel.',
     82   GUILD_CHANNEL_ORPHAN: 'Could not find a parent to this guild channel.',
     83   GUILD_OWNED: 'Guild is owned by the client.',
     84   GUILD_MEMBERS_TIMEOUT: "Members didn't arrive in time.",
     85   GUILD_UNCACHED_ME: 'The client user as a member of this guild is uncached.',
     86 
     87   INVALID_TYPE: (name, expected, an = false) => `Supplied ${name} is not a${an ? 'n' : ''} ${expected}.`,
     88 
     89   WEBHOOK_MESSAGE: 'The message was not sent by a webhook.',
     90 
     91   EMOJI_TYPE: 'Emoji must be a string or GuildEmoji/ReactionEmoji',
     92   EMOJI_MANAGED: 'Emoji is managed and has no Author.',
     93   MISSING_MANAGE_EMOJIS_PERMISSION: guild =>
     94     `Client must have Manage Emoji permission in guild ${guild} to see emoji authors.`,
     95 
     96   REACTION_RESOLVE_USER: "Couldn't resolve the user ID to remove from the reaction.",
     97 
     98   VANITY_URL: 'This guild does not have the VANITY_URL feature enabled.',
     99 
    100   DELETE_GROUP_DM_CHANNEL: "Bots don't have access to Group DM Channels and cannot delete them",
    101   FETCH_GROUP_DM_CHANNEL: "Bots don't have access to Group DM Channels and cannot fetch them",
    102 };
    103 
    104 for (const [name, message] of Object.entries(Messages)) register(name, message);