SteamKit2.SteamFriends.SendChatRoomMessage C# (CSharp) Method

SendChatRoomMessage() public method

Sends a message to a chat room.
public SendChatRoomMessage ( SteamID steamIdChat, EChatEntryType type, string message ) : void
steamIdChat SteamID The SteamID of the chat room.
type EChatEntryType The message type.
message string The message.
return void
        public void SendChatRoomMessage( SteamID steamIdChat, EChatEntryType type, string message )
        {
            SteamID chatId = steamIdChat.ConvertToUInt64(); // copy the steamid so we don't modify it

            if ( chatId.IsClanAccount )
            {
                // this steamid is incorrect, so we'll fix it up
                chatId.AccountInstance = ( uint )SteamID.ChatInstanceFlags.Clan;
                chatId.AccountType = EAccountType.Chat;
            }

            var chatMsg = new ClientMsg<MsgClientChatMsg>();

            chatMsg.Body.ChatMsgType = type;
            chatMsg.Body.SteamIdChatRoom = chatId;
            chatMsg.Body.SteamIdChatter = Client.SteamID;

            chatMsg.WriteNullTermString( message, Encoding.UTF8 );

            this.Client.Send( chatMsg );
        }