当前位置: 首页>>代码示例>>C#>>正文


C# Session.SendSysMessage方法代码示例

本文整理汇总了C#中Session.SendSysMessage方法的典型用法代码示例。如果您正苦于以下问题:C# Session.SendSysMessage方法的具体用法?C# Session.SendSysMessage怎么用?C# Session.SendSysMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Session的用法示例。


在下文中一共展示了Session.SendSysMessage方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SendHistory

        public override void SendHistory(Session session)
        {
            base.SendHistory(session);

            if (Chat == null)
                session.SendSysMessage("Not connected to Steam.");
        }
开发者ID:ToXIcGaming,项目名称:SteamMobile,代码行数:7,代码来源:SteamRoom.cs

示例2: Handle

        public override void Handle(Session session)
        {
            if (session.Account == null)
            {
                session.SendSysMessage("Guests can not speak.");
                return;
            }

            Content = Content.Trim();

            if (Content.Length == 0)
                return;

            // can't send emoticons from web
            Content = Content.Replace('ː', ':');

            // steam discards long messages
            if (Content.Length > 2000)
                Content = Content.Substring(0, 2000) + "...";

            Room room = Program.RoomManager.Get(session.Room);
            if (room == null)
            {
                if (Command.Handle(new CommandTarget(session), Content, "/"))
                    return;

                if (Command.Handle(new CommandTarget(session), Content, "~"))
                    return;

                session.SendSysMessage("RohBot is not in this room.");
                return;
            }

            if (Program.DelayManager.AddAndCheck(session, 1))
                return;

            room.SendMessage(session, Content);
        }
开发者ID:ToXIcGaming,项目名称:SteamMobile,代码行数:38,代码来源:SendMessage.cs

示例3: Handle

        public override void Handle(Session session)
        {
            if (Program.DelayManager.AddAndCheck(session, 2.5))
                return;

            var room = Program.RoomManager.Get(session.Room);
            if (room == null)
            {
                session.SendSysMessage("Room does not exist.");
                return;
            }

            if (room.IsPrivate)
            {
                if (session.Account == null || room.IsBanned(session.Account.Name))
                    return;
            }

            List<HistoryLine> lines;

            if (Util.DateTimeFromUnixTimestamp(AfterDate) > DateTime.UtcNow.AddDays(-7))
            {
                var cmd = new SqlCommand("SELECT * FROM rohbot.chathistory WHERE chat=lower(:chat) AND date<:afterdate ORDER BY date DESC LIMIT 100;");
                cmd["chat"] = session.Room;
                cmd["afterdate"] = AfterDate;
                lines = cmd.Execute().Select(r => (HistoryLine)HistoryLine.Read(r)).Reverse().ToList();
            }
            else
            {
                lines = new List<HistoryLine>();
            }

            var history = new ChatHistory
            {
                Name = room.RoomInfo.Name,
                ShortName = room.RoomInfo.ShortName,
                Requested = true,
                Lines = lines
            };

            session.Send(history);
        }
开发者ID:ToXIcGaming,项目名称:SteamMobile,代码行数:42,代码来源:ChatHistoryRequest.cs

示例4: SendMessage

        /// <summary>
        /// Called when somebody sends a message.
        /// </summary>
        public void SendMessage(Session session, string message)
        {
            if (!message.StartsWith("//") && Command.Handle(new CommandTarget(session), message, "/"))
                return;

            if (!message.StartsWith("~~") && Command.Handle(new CommandTarget(session), message, "~"))
                return;

            if (message.StartsWith("//") || message.StartsWith("~~"))
                message = message.Substring(1);

            if (IsBanned(session.Account.Name))
            {
                session.SendSysMessage("You are banned from this room.");
                return;
            }

            var roomName = RoomInfo.ShortName;
            var userName = session.Account.Name;
            var userId = session.Account.Id.ToString();
            var userStyle = session.Account.EnabledStyle;
            var line = new ChatLine(Util.GetCurrentUnixTimestamp(), roomName, "RohBot", userName, userId, userStyle, message, false);
            SendLine(line);
        }
开发者ID:ToXIcGaming,项目名称:SteamMobile,代码行数:27,代码来源:Room.cs

示例5: SendHistory

        /// <summary>
        /// Called when somebody joins the room. Should call base.
        /// </summary>
        public virtual void SendHistory(Session session)
        {
            if (IsPrivate)
            {
                if (session.Account == null)
                {
                    ClearScrollbackFor(session);
                    session.SendSysMessage("You must login to view this room.");
                    return;
                }

                if (IsBanned(session.Account.Name))
                {
                    ClearScrollbackFor(session);
                    session.SendSysMessage("You are banned from this room. To view it you must be unbanned (or whitelisted).");
                    return;
                }
            }

            lock (_history)
            {
                var chatHistory = new ChatHistory { Name = RoomInfo.Name, ShortName = RoomInfo.ShortName, Requested = false, Lines = _history.ToList() };
                session.Send(chatHistory);
            }
        }
开发者ID:ToXIcGaming,项目名称:SteamMobile,代码行数:28,代码来源:Room.cs


注:本文中的Session.SendSysMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。