Add Channel Group
Creates a new channel group using a given name and displays its ID. The only required Parameter is
channelGroupName. groupType is optional depending on what you are doing.
Parameters:
channelGroupName: the name of the group
groupType: the type of the group(Query, Template, Regular)
Sample Code VB.net
Imports TS3QueryLib.Core.Query
Imports TS3QueryLib.Core.CommandHandling
...
queryRunner.SelectVirtualServerById(1)
queryRunner.AddChannelGroup(ByVal channelGroupName As String, ByVal groupType As TS3QueryLib.Core.CommandHandling.GroupDatabaseType)
Sample Code C#
using TS3QueryLib.Core.Query;
using TS3QueryLib.Core.CommandHandling;
...
queryRunner.SelectVirtualServerById(1);
queryRunner.AddChannelGroup(string channelGroupName, TS3QueryLib.Core.CommandHandling.GroupDatabaseType groupType);
You can find the Connect to server Example on the Connect To Server Page
Example Usage VB.net
Imports TS3QueryLib.Core.Query
Imports TS3QueryLib.Core.CommandHandling
Imports TS3QueryLib.Core.Query.Responses
...
Dim targetHost As String = "127.0.0.1"
Dim targetQueryPort As UShort = 10011
Dim login As String = "serveradmin"
Dim password As String = "ServerAdminPassword"
Using queryRunner As New QueryRunner(New SyncTcpDispatcher(targetHost, targetQueryPort))
Dim loginResponse As SimpleResponse = queryRunner.Login(login, password)
If loginResponse.IsErroneous Then
MsgBox("There was An Error")
Else
'Selects the Server By Port. You can also use queryRunner.SelectVirtualServerById(1)
queryRunner.SelectVirtualServerByPort(9987)
'Adds the Channel Group. Using a DataBase Type of Regular
Dim AddChannelGroup As SingleValueResponse(Of UInteger?) = queryRunner.AddChannelGroup("Channel Group Name", GroupDatabaseType.Regular)
'If there are no Errors then Message Box Shows and says Channel Group Created and Displays the Channel Group ID with the SingleValueResponse
If Not AddChannelGroup.IsErroneous Then
MsgBox(String.Format("Channel Group Created! || Group ID: {0}", AddChannelGroup.Value))
End If
End If
End Using
Example Usage C#
using TS3QueryLib.Core.Query;
using TS3QueryLib.Core.CommandHandling;
using TS3QueryLib.Core.Query.Responses;
...
string targetHost = "127.0.0.1";
ushort targetQueryPort = 10011;
string login = "serveradmin";
string password = "ServerAdminPassword";
using (QueryRunner queryRunner = new QueryRunner(new SyncTcpDispatcher(targetHost, targetQueryPort)))
{
SimpleResponse loginResponse = queryRunner.Login(login, password);
if (loginResponse.IsErroneous)
{
MessageBox.Show("There was An Error");
}
else
{
//Selects the Server By Port. You can use queryRunner.SelectVirtualServerById(1)
queryRunner.SelectVirtualServerByPort(9987);
//Adds the Channel Group. Using a DataBase Type of Regular
SingleValueResponse<uint?> AddChannelGroup = queryRunner.AddChannelGroup("Channel Group Name", GroupDatabaseType.Regular);
//If there are no Errors then Message Box Shows and says Channel Group Created and Displays the Channel Group ID with the SingleValueResponse
if (!AddChannelGroup.IsErroneous)
{
MessageBox.Show(string.Format("Channel Group Created! || Group ID: {0}", AddChannelGroup.Value));
}
}
}
The two above Examples are Using the Parameter groupType.
Note: that the groupType parameter is optional to use. Unless you are wanting to create a Query or Template Group If you go without using that parameter the group type will be default at Regular.