示例#1
0
        public string DummyTalk(UserMessage message)
        {
            string result = "";

            if (message.Message.ToLower().Contains("запретить") &&
                !message.Message.ToLower().Contains("законодательном"))
            {
                result = "На законодательном уровне!";
            }

            if (message.Message.ToLower().StartsWith("!info"))
            {
                var stringList = SwagContainer.Resolve <IPluginContainer>().Plugins.Select(x => x.PluginName).ToList();
                result = "Доступные плагины: " + string.Join(", ", stringList);
            }

            if (message.Message.ToLower().StartsWith("!zay") &&
                message.UserName == Program.Configuration["Irc:BotAdmin"])
            {
                var say = message.Message.ToLower().Replace("!zay", "").Trim();
                result = say;
            }

            if (message.Message.ToLower().StartsWith("!join") &&
                message.UserName == Program.Configuration["Irc:BotAdmin"])
            {
                var targetChannel = message.Message.ToLower().Replace("!join", "").Trim();
                if (!targetChannel.StartsWith("#"))
                {
                    targetChannel = "#" + targetChannel;
                }
                _ircBot.JoinChannel(targetChannel);
            }

            if (message.Message.ToLower().StartsWith("!leave") &&
                message.UserName == Program.Configuration["Irc:BotAdmin"])
            {
                var targetChannel = message.Message.ToLower().Replace("!leave", "").Trim();
                if (!targetChannel.StartsWith("#"))
                {
                    targetChannel = "#" + targetChannel;
                }
                _ircBot.LeaveChannel(targetChannel);
            }

            if (message.Message.ToLower().StartsWith("!quit") &&
                message.UserName == Program.Configuration["Irc:BotAdmin"])
            {
                _ircBot.Dispose();
            }

            return(result);
        }