Наследование: IDisposable
Пример #1
0
        public static void Main(string[] args)
        {
            var client = new UVIrcClient();
            var bot = new IrcBot<UVIrcClient>(client);
            bot.Client.Connect("127.0.0.1", new IrcUserRegistrationInfo() {
                NickName = "txdv-bot",
                UserName = "******",
                RealName = "txdv bot",
            });

            var adminPlugin = new AdminPlugin<UVIrcClient>("bentkus");

            bot.Plugin(adminPlugin);
            bot.Plugin(new Greeter<UVIrcClient>());
            bot.Plugin(new DatabasePlugin<UVIrcClient>(adminPlugin));
            bot.Plugin(new JoinPlugin<UVIrcClient>(adminPlugin));

            UVTimer.Once(TimeSpan.FromSeconds(1), () => client.Channels.Join("#help"));

            var stdin = new TTY(0);
            stdin.Read(Encoding.Default, (line) => {
                line = line.Trim();
                switch (line) {
                case "quit":
                    Loop.Default.Stop();
                    break;
                default:
                    break;
                }
            });
            stdin.Resume();

            Loop.Default.Run();
        }
Пример #2
0
        public static void Main(string[] args)
        {
            IrcBot bot = null;

            try
            {
                // Write information about program.
                Console.WriteLine(ProgramInfo.AssemblyTitle);
                Console.WriteLine("Version {0}", ProgramInfo.AssemblyVersion);
                Console.WriteLine(ProgramInfo.AssemblyCopyright);
                Console.WriteLine();

                // Create and run bot.
                bot = new MarkovChainTextBot();
                bot.Run();
            }
#if !DEBUG
            catch (Exception ex)
            {
                ConsoleUtilities.WriteError("Fatal error: " + ex.Message);
            }
#endif
            finally
            {
                if (bot != null)
                {
                    bot.Dispose();
                }
            }
        }
Пример #3
0
 public IrcMessageCommand(
     IrcBot bot, 
     IrcBotUser user,
     IrcClient client, 
     string[] parameters, 
     IIrcMessageTarget target, 
     IIrcMessageSource source
 )
     : base(bot, user, client, parameters, target, source)
 {
 }
Пример #4
0
        public IrcCommand(
            IrcBot bot, 
            IrcBotUser user,
            IrcClient client, 
            string[] parameters, 
            IIrcMessageTarget target, 
            IIrcMessageSource source
        )
        {
            this.Bot = bot;
            this.User = user;
            this.Client = client;
            this.Target = target;
            this.Source = source;

            ParseParameters(parameters);
        }