CustomGame.InvitePlayer(string playerName, InviteTeam team = InviteTeam.Both);
public bool InvitePlayer(
    string playerName, 
    InviteTeam team = InviteTeam.Both

Battletag of player to invite.
Type: string

Team that they are invited to.
Type: CustomGameOW.InviteTeam

Invites a player to the game via their battletag. Returns false if fails to invite player.

The battletag is case sensitive. The player being invited must be in the region the bot is running on, and played at least one game to completion in said region. (Americas, Europe, Asia, PTR)

When you invite a player to the game, a slot gets filled up despite them not being ingame. You can get the slots/count of players who have an invite with the CustomGame.GetLoadCount() and CustomGame.GetLoadSlots().

The code below will invite Tracer#1818 to the custom game, and display a welcoming message when she joins.

using System;
using CustomGameOW;


static void Main(string[] args)
    CustomGame cg = new CustomGame();

    // Send an invite to Tracer#1818, wait for her to join the game, then send an message welcoming her to the game.

    cg.InvitePlayer("Tracer#1818"); // Invite Tracer#1818 to the game

        int ingame = cg.playercount - cg.GetLoadCount(cg.playerslot); // Get number of players ingame rather than slots filled
        if (ingame > 0)
            cg.Chat("Welcome, Tracer, to the game!");

See also: