mNo edit summary |
Meorawr31439 (talk | contribs) (Add isCommunitiesChannel return, update formatting a bit.) Tag: WoW API docs |
||
(9 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{wowapi}} |
||
− | <center>'''GetChannelName''' ''-Documentation by wowpendium.de-''</center> |
||
+ | Returns information about the specified channel. |
||
+ | id, name, instanceID, isCommunitiesChannel = GetChannelName(id or "name") |
||
⚫ | |||
− | Retrieves the id and the name from a specific channel. |
||
+ | ; id : <font color="#ecbc2a">number</font> - Channel ID to query, e.g. 1 for the chat channel currently addressable using /1. |
||
+ | ; name : <font color="#ecbc2a">string</font> - Name of the channel to query, e.g. "Trade - City". |
||
⚫ | |||
− | id, name = GetChannelName(id); |
||
⚫ | |||
⚫ | |||
+ | ;instanceID : <font color="#ecbc2a">number</font> - Index used to deduplicate channels. Usually zero, unless two channels with the same name exist. |
||
+ | ;isCommunitiesChannel : <font color="#ecbc2a">boolean</font> - True if this is a Blizzard Communities channel, false if not. |
||
+ | == Details == |
||
− | ---- |
||
+ | * Note that querying GetChannelName("Trade - City") may return values which appear to be valid even while the player is not a city. Consider using <code>GetChannelName((GetChannelName("Trade - City"))) > 0</code> to check whether you really have access to the Trade channel. |
||
⚫ | |||
+ | ==Patch changes== |
||
− | :;id : The numeric id of the channel you want to query, or a string containing the name of the channel. |
||
+ | * {{Patch 8.0.1|note=Added <code>isCommunitiesChannel</code> return.}} |
||
− | |||
− | ---- |
||
⚫ | |||
− | |||
⚫ | |||
⚫ | |||
− | ---- |
||
− | ;''Important'' |
||
− | |||
− | If the channel argument is the channel name (ie "testchan1"), then the returned channel name is a nil value. |
||
− | If the channel argument is the channel number (ie 6 or "6"), then the returned channel name is correct. |
||
− | The channel id returns correctly in both cases. |
||
− | |||
− | ---- |
||
− | ;''Example'' |
||
− | -- Check if the specific channel exists |
||
− | myChannel = 1; |
||
− | id, name = GetChannelName(myChannel); |
||
− | if (not id == 0 and name ~= nil) then |
||
− | SendChatMessage("This is just a test.", "CHANNEL", nil, myChannel); |
||
− | end |
||
− | |||
− | ;''Result'' |
||
− | |||
− | Checks if the channel with id stored in myChannel exists and in this case sends the text "This is just a test" to it. |
||
− | |||
− | ---- |
||
− | ;''Description'' |
||
− | |||
− | : Retrieves the name from a specific channel. |
||
− | |||
− | |||
− | ---- |
||
− | {{WoW API}} |
Revision as of 17:03, 13 October 2020
Automated updating of API pages at this location, to reflect patch changes, has ceased from 10.1.7 onwards. |
Returns information about the specified channel.
id, name, instanceID, isCommunitiesChannel = GetChannelName(id or "name")
Arguments
- id
- number - Channel ID to query, e.g. 1 for the chat channel currently addressable using /1.
- name
- string - Name of the channel to query, e.g. "Trade - City".
Returns
- id
- number - The ID of the channel, or 0 if the channel is not found.
- name
- string - The name of the channel, e.g. "Trade - Stormwind", or nil if the player is not in the queried channel.
- instanceID
- number - Index used to deduplicate channels. Usually zero, unless two channels with the same name exist.
- isCommunitiesChannel
- boolean - True if this is a Blizzard Communities channel, false if not.
Details
- Note that querying GetChannelName("Trade - City") may return values which appear to be valid even while the player is not a city. Consider using
GetChannelName((GetChannelName("Trade - City"))) > 0
to check whether you really have access to the Trade channel.
Patch changes
- Patch 8.0.1 (2018-07-17): Added
isCommunitiesChannel
return.