Text Chat
Text chat can be sent with SteamManager.Chat(string)
and received by listening to SteamManager.OnChat
or SteamUser.OnChat
. Chats are sent to and received by everyone in the lobby.
Filters
MPE4S automatically applies a user's Steam chat filtering settings on all incoming messages, including your own messages locally. In addition, you can make your own custom text filters by creating a class which extends from SteamTextFilter
and implementing the SteamTextFilter.Filter(ref string, ulong)
method.
SteamTextFilter
components apply globally, and automatically register and unregister themselves when they are enabled or disabled. The SteamFilter.Order
property configures the order in which text filters are applied, with lower values being applied first.
Included
Three SteamTextFilter
classes have been included.
SteamFriendsTextFilter
The SteamFriendsTextFilter
will remove any messages sent by users that are not the player or their friends.
SteamPrefixTextFilter
The SteamPrefixTextFilter
only keeps messages that are prefixed by one or more prefixes which could be useful for implementing team-based chats.
SteamWordsTextFilter
The SteamWordsTextFilter
will censor defined words. Note that this is mainly just an example, and if you want to make a full profanity filter, it is recommended you find a word list and programmatically load and check it in an efficient manner.