Ready-made chats
Overview
Implementing a chat with all the nuances taken into account is very difficult. We offer using the chat embedded in the overlay.
Open the chat window
Open the main chat:
gp.channels.openChat();
Open any chat by channel ID:
gp.channels.openChat({ id: 123 });
info
The player automatically joins the channel upon opening. Make sure that everyone can join the channel and it is not password protected.
Events for tracking opening and closing of the window:
// Chat opened
gp.channels.on('openChat', () => {});
// Chat closed
gp.channels.on('closeChat', () => {});
// Failed to open chat
gp.channels.on('error:openChat', (err) => {
// errors can be related to access or chat retrieval
});
Check if the main chat can be displayed:
if (gp.channels.isMainChatEnabled) {
// The chat is enabled, you can show the chat button
}
Get the ID of the main chat:
gp.channels.mainChatId;
Possible errors are listed in the table below:
Basic errors | Scenario errors |
---|---|
player_not_found | empty_channel_id |
project_not_found | channel_not_found |
origin_not_allowed | access_denied |
player_banned | |
internal_error |
Selecting the main chat
- Go to the control panel to the Channels section
- Select the main chat or create a new one immediately in the chat selection. A basic chat with all settings for quick start will be created.
- Enable the main chat.
Stay in Touch
Other documents of this chapter available Here. To get started, welcome to the Tutorials chapter.
GamePush Community Telegram
: @gs_community.
For your suggestions e-mail
: [email protected]
We Wish you Success!