{"_id":"5759fe108d9f380e0013300e","user":"571193c63590a50e00bba99d","version":{"_id":"57590727ace5c30e00cb23d7","__v":2,"project":"571193ce8103870e00f48b67","createdAt":"2016-06-09T06:05:27.924Z","releaseDate":"2016-06-09T06:05:27.924Z","categories":["57590727ace5c30e00cb23d8","57590cd318760817001e8a83"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"4.0.0","version":"4.0.0"},"project":"571193ce8103870e00f48b67","__v":32,"category":{"_id":"57590cd318760817001e8a83","__v":0,"project":"571193ce8103870e00f48b67","version":"57590727ace5c30e00cb23d7","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2016-06-09T06:29:39.417Z","from_sync":false,"order":1,"slug":"parts","title":"Parts"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2016-06-09T23:38:56.604Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":999,"body":"The channel object can be a text or voice channel in a guild or a private message channel. It holds members (voice only), messages and overwrites.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Attributes\"\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Private Message Channels\",\n  \"body\": \"The only attributes available on private message channels are `id`, `is_private`, `last_message_id`, `recipient`.\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Name\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"0-0\": \"id\",\n    \"1-0\": \"name\",\n    \"2-0\": \"type\",\n    \"3-0\": \"topic\",\n    \"5-0\": \"guild_id\",\n    \"6-0\": \"position\",\n    \"7-0\": \"is_private\",\n    \"8-0\": \"last_message_id\",\n    \"9-0\": \"permission_overwrites\",\n    \"10-0\": \"bitrate\",\n    \"11-0\": \"recipient\",\n    \"0-1\": \"The unique identifier of the channel.\",\n    \"0-2\": \"snowflake\",\n    \"1-1\": \"The name of the channel.\",\n    \"1-2\": \"string\",\n    \"2-1\": \"Either `voice` or `text`.\",\n    \"2-2\": \"string\",\n    \"3-1\": \"The topic of the channel (only available on text channels).\",\n    \"3-2\": \"string\",\n    \"5-1\": \"The unique identifier of the guild that the channel belongs to.\",\n    \"5-2\": \"snowflake\",\n    \"6-1\": \"The position of the channel on the sidebar.\",\n    \"6-2\": \"int\",\n    \"7-1\": \"Whether the channel is a private message channel.\",\n    \"7-2\": \"bool\",\n    \"8-1\": \"The unique identifier of the last message sent in the channel (only available on text channels).\",\n    \"8-2\": \"snowflake\",\n    \"9-1\": \"An array of raw permission overwrites.\",\n    \"9-2\": \"array[object]\",\n    \"10-1\": \"The bitrate of the channel (only available on voice channels).\",\n    \"10-2\": \"int\",\n    \"11-1\": \"The recipient of the channel (only available on private channels).\",\n    \"11-2\": \"User\",\n    \"4-0\": \"guild\",\n    \"4-1\": \"The guild object that the channel belongs to.\",\n    \"4-2\": \"[Guild](doc:guild)\"\n  },\n  \"cols\": 3,\n  \"rows\": 12\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"setPermissions(Part $part, $allow, $deny)\"\n}\n[/block]\nAdds a permission overwrite to the channel.\n\nReturns a Promise.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Default\",\n    \"0-0\": \"`$part`\",\n    \"0-1\": \"The part to add the permission overwrite for.\",\n    \"0-2\": \"[User](doc:user)\",\n    \"0-3\": \"-\",\n    \"1-0\": \"`$allow`\",\n    \"1-1\": \"The allow permissions for the overwrite.\",\n    \"1-2\": \"[Permission](doc:permission)\",\n    \"1-3\": \"`null`\",\n    \"2-0\": \"`$deny`\",\n    \"2-1\": \"The deny permissions for the overwrite.\",\n    \"2-2\": \"[Permission](doc:permission)\",\n    \"2-3\": \"`null`\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"moveMember(Member $member)\"\n}\n[/block]\nMoves a member to another voice channel. Only works if it is a voice channel, the member is already connected to a voice channel and you have permissions.\n\nReturns a Promise.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Default\",\n    \"0-0\": \"`$member`\",\n    \"0-1\": \"The member to move.\",\n    \"0-2\": \"`Member` or `snowflake` ID\",\n    \"0-3\": \"-\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"createInvite($max_age, $max_uses, $temporary, $xkcd)\"\n}\n[/block]\nCreates an instant invite to the channel.\n\nReturns a Promise with the Invite.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Default\",\n    \"0-0\": \"`$max_age`\",\n    \"0-1\": \"How long the message will last (in seconds, 0 for non-expiring).\",\n    \"0-2\": \"`int`\",\n    \"0-3\": \"`3600`\",\n    \"1-0\": \"`$max_uses`\",\n    \"1-1\": \"How many uses the invite will last for (0 for unlimited).\",\n    \"1-2\": \"`int`\",\n    \"1-3\": \"`0`\",\n    \"2-0\": \"`$temporary`\",\n    \"2-1\": \"Whether the invite is for temporary membership.\",\n    \"2-2\": \"`bool`\",\n    \"2-3\": \"`false`\",\n    \"3-0\": \"`$xkcd`\",\n    \"3-1\": \"Whether the invite should be an XKCD invite.\",\n    \"3-2\": \"`bool`\",\n    \"3-3\": \"`false`\"\n  },\n  \"cols\": 4,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"deleteMessages($messages)\"\n}\n[/block]\nBulk deletes an array of messages. The message array can take [Message](doc:message) objects or `snowflake` IDs.\n\nReturns a Promise.\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Default\",\n    \"0-0\": \"`$messages`\",\n    \"0-1\": \"An array of messages to delete.\",\n    \"0-2\": \"`array`\",\n    \"0-3\": \"-\"\n  },\n  \"cols\": 4,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"getMessageHistory(array $options)\"\n}\n[/block]\nFetches the history of the channel. Only works if it is a text channel.\n\nReturns a Promise with a [Collection](doc:collection).\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"title\": \"Options Array\",\n  \"body\": \"The parameters below should be in an array and passed through.\\n\\n```php\\n$channel->getMessageHistory([\\n    'limit' => 50,\\n    'before' => $beforeMessage,\\n    'after' => $afterMessage,\\n]);\\n```\"\n}\n[/block]\n\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"0-0\": \"`limit`\",\n    \"h-3\": \"Default\",\n    \"0-1\": \"How many messages will be fetched. Has to be between 1 and 100.\",\n    \"0-2\": \"`int`\",\n    \"0-3\": \"`100`\",\n    \"1-0\": \"`before`\",\n    \"1-1\": \"The lower range of the message query.\",\n    \"1-2\": \"[Message](doc:message)\",\n    \"1-3\": \"-\",\n    \"2-0\": \"`after`\",\n    \"2-1\": \"The higher range of the message query.\",\n    \"2-2\": \"[Message](doc:message)\",\n    \"2-3\": \"-\"\n  },\n  \"cols\": 4,\n  \"rows\": 3\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"pinMessage($message)\"\n}\n[/block]\nAdds a message to the channels pins.\n\nReturns a Promise with a [Message](doc:message).\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"0-0\": \"`$message`\",\n    \"0-1\": \"The message to pin.\",\n    \"0-2\": \"[Message](doc:message)\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"unpinMessage($message)\"\n}\n[/block]\nRemoves a message from the channels pins.\n\nReturns a Promise with a [Message](doc:message).\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"0-0\": \"`$message`\",\n    \"0-1\": \"The message to un-pin.\",\n    \"0-2\": \"[Message](doc:message)\"\n  },\n  \"cols\": 3,\n  \"rows\": 1\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"getPinnedMessages()\"\n}\n[/block]\nFetches the channel's pinned messages.\n\nReturns a Promise with a [Collection](doc:collection) of [Messages](doc:message).\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"getInvites()\"\n}\n[/block]\nFetches the channel invites.\n\nReturns a Promise with a [Collection](doc:collection) of [Invites](doc:invite).\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"sendMessage($text, $tts)\"\n}\n[/block]\nSends a message to the channel. Only works if it is a text channel.\n\nReturns a Promise with the [Message](doc:message).\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Default\",\n    \"0-0\": \"`$text`\",\n    \"0-1\": \"The text to send to the channel. Has a max character count of 2000.\",\n    \"0-2\": \"`string`\",\n    \"0-3\": \"-\",\n    \"1-0\": \"`$tts`\",\n    \"1-1\": \"Whether to send the message as a `text-to-speech` message.\",\n    \"1-2\": \"`bool`\",\n    \"1-3\": \"`false`\"\n  },\n  \"cols\": 4,\n  \"rows\": 2\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"sendFile($filepath, $filename, $content, $tts)\"\n}\n[/block]\nSends a file to the channel. Only works if it is a text channel.\n\nReturns a Promise with the [Message](doc:message).\n[block:parameters]\n{\n  \"data\": {\n    \"h-0\": \"Parameter\",\n    \"h-1\": \"Description\",\n    \"h-2\": \"Type\",\n    \"h-3\": \"Default\",\n    \"0-0\": \"`$filepath`\",\n    \"0-1\": \"The file path to the file to upload.\",\n    \"0-2\": \"`string`\",\n    \"0-3\": \"-\",\n    \"1-0\": \"`$filename`\",\n    \"1-1\": \"The name to upload the file as.\",\n    \"1-2\": \"`string`\",\n    \"1-3\": \"-\",\n    \"2-0\": \"`$content`\",\n    \"2-1\": \"The text to send to the channel. Has a max character count of 2000.\",\n    \"2-2\": \"`string`\",\n    \"2-3\": \"`null`\",\n    \"3-0\": \"`$tts`\",\n    \"3-1\": \"Whether to send the message as a `text-to-speech` message.\",\n    \"3-2\": \"`bool`\",\n    \"3-3\": \"`false`\"\n  },\n  \"cols\": 4,\n  \"rows\": 4\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"fn\",\n  \"title\": \"broadcastTyping()\"\n}\n[/block]\nBroadcasts typing to the channel. Only works if it is a voice channel.\n\nReturns a Promise.","excerpt":"The channel object can be either a text or voice channel.","slug":"channel","type":"basic","title":"Channel"}

Channel

The channel object can be either a text or voice channel.

The channel object can be a text or voice channel in a guild or a private message channel. It holds members (voice only), messages and overwrites. [block:api-header] { "type": "basic", "title": "Attributes" } [/block] [block:callout] { "type": "warning", "title": "Private Message Channels", "body": "The only attributes available on private message channels are `id`, `is_private`, `last_message_id`, `recipient`." } [/block] [block:parameters] { "data": { "h-0": "Name", "h-1": "Description", "h-2": "Type", "0-0": "id", "1-0": "name", "2-0": "type", "3-0": "topic", "5-0": "guild_id", "6-0": "position", "7-0": "is_private", "8-0": "last_message_id", "9-0": "permission_overwrites", "10-0": "bitrate", "11-0": "recipient", "0-1": "The unique identifier of the channel.", "0-2": "snowflake", "1-1": "The name of the channel.", "1-2": "string", "2-1": "Either `voice` or `text`.", "2-2": "string", "3-1": "The topic of the channel (only available on text channels).", "3-2": "string", "5-1": "The unique identifier of the guild that the channel belongs to.", "5-2": "snowflake", "6-1": "The position of the channel on the sidebar.", "6-2": "int", "7-1": "Whether the channel is a private message channel.", "7-2": "bool", "8-1": "The unique identifier of the last message sent in the channel (only available on text channels).", "8-2": "snowflake", "9-1": "An array of raw permission overwrites.", "9-2": "array[object]", "10-1": "The bitrate of the channel (only available on voice channels).", "10-2": "int", "11-1": "The recipient of the channel (only available on private channels).", "11-2": "User", "4-0": "guild", "4-1": "The guild object that the channel belongs to.", "4-2": "[Guild](doc:guild)" }, "cols": 3, "rows": 12 } [/block] [block:api-header] { "type": "fn", "title": "setPermissions(Part $part, $allow, $deny)" } [/block] Adds a permission overwrite to the channel. Returns a Promise. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Default", "0-0": "`$part`", "0-1": "The part to add the permission overwrite for.", "0-2": "[User](doc:user)", "0-3": "-", "1-0": "`$allow`", "1-1": "The allow permissions for the overwrite.", "1-2": "[Permission](doc:permission)", "1-3": "`null`", "2-0": "`$deny`", "2-1": "The deny permissions for the overwrite.", "2-2": "[Permission](doc:permission)", "2-3": "`null`" }, "cols": 4, "rows": 3 } [/block] [block:api-header] { "type": "fn", "title": "moveMember(Member $member)" } [/block] Moves a member to another voice channel. Only works if it is a voice channel, the member is already connected to a voice channel and you have permissions. Returns a Promise. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Default", "0-0": "`$member`", "0-1": "The member to move.", "0-2": "`Member` or `snowflake` ID", "0-3": "-" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "fn", "title": "createInvite($max_age, $max_uses, $temporary, $xkcd)" } [/block] Creates an instant invite to the channel. Returns a Promise with the Invite. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Default", "0-0": "`$max_age`", "0-1": "How long the message will last (in seconds, 0 for non-expiring).", "0-2": "`int`", "0-3": "`3600`", "1-0": "`$max_uses`", "1-1": "How many uses the invite will last for (0 for unlimited).", "1-2": "`int`", "1-3": "`0`", "2-0": "`$temporary`", "2-1": "Whether the invite is for temporary membership.", "2-2": "`bool`", "2-3": "`false`", "3-0": "`$xkcd`", "3-1": "Whether the invite should be an XKCD invite.", "3-2": "`bool`", "3-3": "`false`" }, "cols": 4, "rows": 4 } [/block] [block:api-header] { "type": "fn", "title": "deleteMessages($messages)" } [/block] Bulk deletes an array of messages. The message array can take [Message](doc:message) objects or `snowflake` IDs. Returns a Promise. [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Default", "0-0": "`$messages`", "0-1": "An array of messages to delete.", "0-2": "`array`", "0-3": "-" }, "cols": 4, "rows": 1 } [/block] [block:api-header] { "type": "fn", "title": "getMessageHistory(array $options)" } [/block] Fetches the history of the channel. Only works if it is a text channel. Returns a Promise with a [Collection](doc:collection). [block:callout] { "type": "warning", "title": "Options Array", "body": "The parameters below should be in an array and passed through.\n\n```php\n$channel->getMessageHistory([\n 'limit' => 50,\n 'before' => $beforeMessage,\n 'after' => $afterMessage,\n]);\n```" } [/block] [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "0-0": "`limit`", "h-3": "Default", "0-1": "How many messages will be fetched. Has to be between 1 and 100.", "0-2": "`int`", "0-3": "`100`", "1-0": "`before`", "1-1": "The lower range of the message query.", "1-2": "[Message](doc:message)", "1-3": "-", "2-0": "`after`", "2-1": "The higher range of the message query.", "2-2": "[Message](doc:message)", "2-3": "-" }, "cols": 4, "rows": 3 } [/block] [block:api-header] { "type": "fn", "title": "pinMessage($message)" } [/block] Adds a message to the channels pins. Returns a Promise with a [Message](doc:message). [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "0-0": "`$message`", "0-1": "The message to pin.", "0-2": "[Message](doc:message)" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "fn", "title": "unpinMessage($message)" } [/block] Removes a message from the channels pins. Returns a Promise with a [Message](doc:message). [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "0-0": "`$message`", "0-1": "The message to un-pin.", "0-2": "[Message](doc:message)" }, "cols": 3, "rows": 1 } [/block] [block:api-header] { "type": "fn", "title": "getPinnedMessages()" } [/block] Fetches the channel's pinned messages. Returns a Promise with a [Collection](doc:collection) of [Messages](doc:message). [block:api-header] { "type": "fn", "title": "getInvites()" } [/block] Fetches the channel invites. Returns a Promise with a [Collection](doc:collection) of [Invites](doc:invite). [block:api-header] { "type": "fn", "title": "sendMessage($text, $tts)" } [/block] Sends a message to the channel. Only works if it is a text channel. Returns a Promise with the [Message](doc:message). [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Default", "0-0": "`$text`", "0-1": "The text to send to the channel. Has a max character count of 2000.", "0-2": "`string`", "0-3": "-", "1-0": "`$tts`", "1-1": "Whether to send the message as a `text-to-speech` message.", "1-2": "`bool`", "1-3": "`false`" }, "cols": 4, "rows": 2 } [/block] [block:api-header] { "type": "fn", "title": "sendFile($filepath, $filename, $content, $tts)" } [/block] Sends a file to the channel. Only works if it is a text channel. Returns a Promise with the [Message](doc:message). [block:parameters] { "data": { "h-0": "Parameter", "h-1": "Description", "h-2": "Type", "h-3": "Default", "0-0": "`$filepath`", "0-1": "The file path to the file to upload.", "0-2": "`string`", "0-3": "-", "1-0": "`$filename`", "1-1": "The name to upload the file as.", "1-2": "`string`", "1-3": "-", "2-0": "`$content`", "2-1": "The text to send to the channel. Has a max character count of 2000.", "2-2": "`string`", "2-3": "`null`", "3-0": "`$tts`", "3-1": "Whether to send the message as a `text-to-speech` message.", "3-2": "`bool`", "3-3": "`false`" }, "cols": 4, "rows": 4 } [/block] [block:api-header] { "type": "fn", "title": "broadcastTyping()" } [/block] Broadcasts typing to the channel. Only works if it is a voice channel. Returns a Promise.