Esempio n. 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();
        }
Esempio n. 2
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();
        }
Esempio n. 3
0
        public static void Main(string[] args)
        {
            var context = Context.Create();

              IrcBot bot = new IrcBot(context);

              bot.SendDelay = 0;

              var adminPlugin = new AdminPlugin("txdv");

              bot.Plugin(adminPlugin);
              bot.Plugin(new TestPlugin(adminPlugin));
              bot.Plugin(new FloodPlugin());

              //bot.SendDelay = 0;

              bot.Connect(new string[] { "127.0.0.1" }, 6667, delegate {
            bot.ActiveChannelSyncing = true;
            bot.Login("bot", "test bot");
            bot.RfcJoin("#six");
              });

              context.Start();
        }
Esempio n. 4
0
 public TestPlugin(AdminPlugin plugin)
 {
     AdminPlugin = plugin;
       On = true;
 }
Esempio n. 5
0
 public JoinPlugin(AdminPlugin <T> plugin)
 {
     AdminPlugin = plugin;
 }
Esempio n. 6
0
 public DatabasePlugin(AdminPlugin <T> plugin)
 {
     AdminPlugin = plugin;
     On          = true;
 }