Wowpedia

We have moved to Warcraft Wiki. Click here for information and the new URL.

READ MORE

Wowpedia
mNo edit summary
(Add isCommunitiesChannel return, update formatting a bit.)
Tag: WoW API docs
(12 intermediate revisions by 9 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")
   
 
== Arguments ==
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".
   
 
== Returns ==
id, name = GetChannelName(id);
 
 
;id : <font color="#ecbc2a">number</font> - The ID of the channel, or 0 if the channel is not found.
 
;name : <font color="#ecbc2a">string</font> - The name of the channel, e.g. "Trade - Stormwind", or nil if the player is not in the queried channel.
  +
;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.
;''Arguments''
 
:(Number id or String id)
 
   
  +
==Patch changes==
:;id : The id of the channel you want to query, either as a number (1) or as a string ("1"). It seems that ("Trade") also works.
 
  +
* {{Patch 8.0.1|note=Added <code>isCommunitiesChannel</code> return.}}
 
----
 
;''Returns''
 
 
:;id : a number containing the id of the channel, e.g. 2, or 0 if the channel is not found
 
:;name : a string containing the name of the channel, e.g. "Trade - Stormwind", or nil if the channel is not found.
 
----
 
;''Important''
 
 
If the channel argument is the channel name (ie "testchan1"), then the returned channel name is a nil value.<br>
 
If the channel argument is the channel number (ie 6 or "6"), then the returned channel name is correct.<br>
 
The channel id returns correctly in both cases.<br>
 
 
----
 
;''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.
 
 
----
 
{{Template:WoW API}}
 
[[Category:API Functions|GetChannelName]]
 
[[Category:API Channel Functions|GetChannelName]]
 

Revision as of 17:03, 13 October 2020

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

  • Battle for Azeroth Patch 8.0.1 (2018-07-17): Added isCommunitiesChannel return.