Skip to Content
ModulesCommunity

Chat

The Chat module: site channels with a live feed, mentions, stickers, a channel per server, chat on every page and message moderation.

The module adds a chat with channels to the site. Players write in a live feed, mention each other with @login, react, and send pictures and stickers. The chat opens as the "Chat" section at /chat and as a window on any page of the site. Other modules create channels too: a clan, for example, gets a closed channel of its own.

The Chat section with channels on the left and the message feed
DependenciesGamesPermissionsStudio blocksBot commandsCron tasks
Flute 2.0anyadmin.chat, admin.chat.view, chat.moderate, chat.moderate.all, chat.messages.delete, chat.messages.pin, chat.messages.deleted, chat.slowmode"Chat feed"none"Chat: sweep of deleted messages and channels", daily

Where the module shows up

PlaceWhat is there
The "Chat" section and menu itemevery channel open to the player, search in a channel, "Who is here"
Chat on the site's pagesa button with a window, or a side panel, on every page except the chat page itself
AdminChat channelsthe channel list with access, limits and activity over 30 days
AdminStickerssticker packs: your own and ones copied from Telegram
A server in the admin panelthe "Chat channel: switch on" action creates a "Server :name" channel
Profile settings, notifications"Chat channels without notifications"
Studiothe "Chat feed" block with a "Channel" field

On install the module creates one open channel, "General", with the address general, so people can write right away.

Install and first setup

Install the module from the marketplace as described in first steps. The admin menu gets "Chat channels" and "Stickers". The general settings open with the "Settings" button on the channels screen: AdminChat channelsSettings.

The Chat channels screen with the site channels

Right after install, "General" is open to every signed-in visitor and guests cannot read the chat. If the chat is meant for some players only, set up channels by role as shown below.

A channel for your roles, and moderation

Say you want a "Server news" channel where only admins write, and a closed channel for VIP players with a pause between messages.

Create the channel

On the "Chat channels" screen click "Add a channel". Fill in "Name" and "Channel address" (Latin letters, digits and a hyphen). For news, set "Type" to "Announcements": in such a channel only the roles under "Write" and moderators write.

The channel window with the Basics, Who sees and writes, Rules and Limits sections

Decide who sees and writes

"Who sees and writes" holds two role lists. "Write" roles read and write, "Read only" roles see the channel without the right to write. With both lists empty the channel is open to every signed-in visitor. For the VIP channel put the VIP role under "Write" and leave "Read only" empty: nobody else will see the channel.

Add rules and limits

"Channel rules" are written in Markdown and shown in the channel head. Under "Limits", pick a "Slow mode": the pause between messages of one author. Turn on "Pictures in messages" if the channel's writers may attach a picture.

Give moderators their permissions

In roles, give moderators chat.moderate. It covers deleting other people's messages, pinning, seeing deleted ones and changing slow mode, but only in channels the role can see. For a moderator who reads and runs every channel regardless of channel roles, grant chat.moderate.all.

In the feed a moderator opens a message's "More" menu and picks "Pin" or "Delete". The "Pause" button in the channel head changes slow mode on the spot, to "No pause" or "Once in 30 s". Moderators keep seeing a deleted message for 30 days, then it is erased.

You can stop someone from writing: in a report or on the player card pick "Forbid writing" and set "Where it applies" to "Chat". The player sees "You may not write in the chat" with the reason and the term. Player reports on messages land in the shared "Reports & requests" queue, on the "Content reports" tab.

Stickers

On AdminStickers click "New pack", enter a "Name" and upload the files: WEBP, PNG, WEBM or TGS up to 1 MB. Click a sticker to give it an emoji. An empty pack is hidden in the chat.

To copy a Telegram pack, click "From Telegram", paste https://t.me/addstickers/<name> or only the pack name and click "Import". Importing the same pack again updates it. The import needs a connected Telegram bot; your own stickers upload without one.

The Stickers screen with packs and the From Telegram button

Settings

AdminChat channelsSettings. The page address is /admin/modules/Chat/settings. The fields are grouped into "Access and features", "Messages", "Flood", "Live refresh", "Storage", "Announcements", "Texts" and "Chat on every page".

FieldWhat it changesDefault
"Chat section is on"a switched-off chat leaves the menu and does not open; channels and messages are kepton
"Guests read open channels"a guest sees channels marked "Visible to guests"off
"Who writes in a server channel""Every signed-in visitor" or "Only those who played on the server""Every signed-in visitor"
"Show who is in the channel now"the counter and list of people with the channel openon
"Reactions on messages"reactions, with the set shared with site commentson
"Message length, characters"1 to 4000720
"Time to edit, seconds"how long an author may change a message, 0 = never300
"Mentions in one message"a message with more mentions is not sent10
"Messages a minute from one author"flood protection, 0 = no limit, moderators are exempt20
"No repeats for, seconds"the same message from the same author within this time is not sent60
"Slow mode steps, seconds"what a moderator picks a channel's pause from5, 10, 15, 30, 60, 300
"Keep messages, days"older messages go in the daily sweep, pinned ones stay, 0 keeps them for good0
"Keep archived channels, days"after this many days an archived channel is erased with its messages30
"Channel for announcements"where the site posts its own news, such as a giveaway starting"The first announcement channel"
"Chat on the site's pages"the chat window or panel on every pageon
"View""Button and window" or "Side panel""Button and window"
"Do not show on pages"one address a line, e.g. /shop, together with every page under itempty

For developers

The module fires MessagePosted, MessageEdited, MessageDeleted, ChannelCreated and ChannelDeleted, and sends the chat.message_posted webhook ("Chat: a new message in a site channel") for the site's own channels only; channels of other modules' objects stay out of it. Webhooks are set up under webhooks.

A module adds its own channel kind through the Flute\Modules\Chat\Contracts\ChannelAccessResolver contract, which decides who reads and writes an object's channel. Clan and server channels work this way. A module registers a card for its records in "Share" with the MessageAttachment contract in the Attachments service, and posts a line to the announcement channel with Announcements::post(). Channels of a switched-off or removed module move to the "Orphaned" tab, and "Remove the orphaned" clears them.

How the core side works: Events and listeners, Another module in the provider, Extension points.

Troubleshooting

For any other message, use the error lookup.

Connect the site bot first.

The Telegram sticker import goes through the site bot. Connect it on the bots page and run the import again.

This channel is removed by the module it belongs to.

A clan's or another object's channel is removed by the module that created it; the admin panel cannot delete it. A server channel is switched off with "Chat channel: switch off" on the server page, and its messages are kept for 30 days after that.

MessageWhat to do
"You may only read this channel."the player's role is under "Read only", or the channel type is "Announcements"
"You have no access to this channel."none of the player's roles is in the channel lists
"The channel is in slow mode: the next message can be sent in :seconds s."wait, or lift the pause with "Pause"
"You write too often. Wait :seconds s.""Messages a minute from one author" kicked in
"You have just sent the same message.""No repeats for, seconds" kicked in
"The message has words forbidden on the site."the message hit the site's shared word filter
"The address is taken or is not Latin letters, digits and a hyphen."change the "Channel address"
"Telegram does not know this pack."check the pack name in the t.me/addstickers/ link

Next

On this page