コード例 #1
0
ファイル: Program.cs プロジェクト: RavenB/gridsearch
        static void Main(string[] args)
        {
            int ircPort;

            if (args.Length < 7 || !UUID.TryParse(args[3], out _MasterID) || !int.TryParse(args[5], out ircPort) || args[6].IndexOf('#') == -1)
                Console.WriteLine("Usage: ircgateway.exe <firstName> <lastName> <password> <masterUUID> <ircHost> <ircPort> <#channel>");

            else
            {
                _Client = new GridClient();
                _Client.Network.OnLogin += new NetworkManager.LoginCallback(Network_OnLogin);
                _Client.Self.ChatFromSimulator += new EventHandler<ChatEventArgs>(Self_ChatFromSimulator);                
                _Client.Self.IM += Self_IM;
                _ClientLogin = _Client.Network.DefaultLoginParams(args[0], args[1], args[2], "", "IRCGateway");

                _AutoJoinChannel = args[6];
                _IRC = new IRCClient(args[4], ircPort, "SLGateway", "Second Life Gateway");
                _IRC.OnConnected += new IRCClient.ConnectCallback(_IRC_OnConnected);
                _IRC.OnMessage += new IRCClient.MessageCallback(_IRC_OnMessage);

                _IRC.Connect();

                string read = Console.ReadLine();
                while (read != null) read = Console.ReadLine();                
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: DigDug101/Raspberry-Bot
        static void Main(string[] args)
        {
            int ircPort;

            if (args.Length < 7 || !UUID.TryParse(args[3], out _MasterID) || !int.TryParse(args[5], out ircPort) || args[6].IndexOf('#') == -1)
            {
                Console.WriteLine("Usage: ircgateway.exe <firstName> <lastName> <password> <masterUUID> <ircHost> <ircPort> <#channel>");
            }

            else
            {
                _Client = new GridClient();
                _Client.Network.LoginProgress  += Network_OnLogin;
                _Client.Self.ChatFromSimulator += Self_ChatFromSimulator;
                _Client.Self.IM += Self_IM;
                _ClientLogin     = _Client.Network.DefaultLoginParams(args[0], args[1], args[2], "", "IRCGateway");

                _AutoJoinChannel  = args[6];
                _IRC              = new IRCClient(args[4], ircPort, "SLGateway", "Second Life Gateway");
                _IRC.OnConnected += new IRCClient.ConnectCallback(_IRC_OnConnected);
                _IRC.OnMessage   += new IRCClient.MessageCallback(_IRC_OnMessage);

                _IRC.Connect();

                string read = Console.ReadLine();
                while (read != null)
                {
                    read = Console.ReadLine();
                }
            }
        }
コード例 #3
0
        /// <summary>
        ///  Helper to initialise all of the clients we will need
        /// </summary>
        private static void InitialiseClients()
        {
            _ircClient = new IRCClient(
                ClientConnectionSettings.IRC_SERVER,
                ClientConnectionSettings.IRC_PORT,
                ClientConnectionSettings.IRC_USER,
                ClientConnectionSettings.IRC_NICK,
                ClientConnectionSettings.IRC_PASSWORD);

            // Try and connect to the irc server with a 20 second timeout
            if (!_ircClient.Connect(20000))
            {
                throw new Exception("Failed to connect to IRC server.");
            }

            _ircClient.JoinChannel(ClientConnectionSettings.IRC_CHANNEL);

            _imgur = new ImgurClient(
                ClientConnectionSettings.IMGUR_CLIENT_ID,
                ClientConnectionSettings.IMGUR_CLIENT_SECRET,
                ClientConnectionSettings.IMGUR_REFRESH_TOKEN);

            _telegramClient = new TelegramClient(
                ClientConnectionSettings.TELEGRAM_SERVER,
                ClientConnectionSettings.TELEGRAM_TOKEN,
                ClientConnectionSettings.TELEGRAM_CLIENT_ID);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: JacobMisirian/JacoBot
 public static void Main(string[] args)
 {
     string[] configuration = File.ReadAllLines(args[0]);
     IRCClient = new IRCClient(configuration[0], Convert.ToInt32(configuration[1]), configuration[2], configuration[3], Convert.ToBoolean(configuration[4]), configuration[5]);
     IRCClient.Connect();
     IRCClient.MessageRecieved += IRCClient_OnMessageRecieved;
     IRCClient.Kicked += IRCClient_OnKicked;
     IRCClient.BeginListening();
 }
コード例 #5
0
        static void Main(string[] args)
        {
            IConfig config = container.GetRequiredService <IConfig>();
            var     logger = config.GetLogger("IRCClient");

            logger.Error("test");

            IRCClient client = new IRCClient("irc.quakenet.org", 6667, "HappyIRC", "HappyIRC", config);

            client.Connect();
        }
コード例 #6
0
ファイル: Program.cs プロジェクト: tabaha/meguca
        static void Main(string[] args)
        {
            PixivDownloader downloader = new PixivDownloader("pixiv.json");
            IRCClient       ircClient  = JsonConvert.DeserializeObject <IRCClient>(File.ReadAllText("irc.json"));

            ircClient.PixivDownloader = downloader;

            TelegramClient telegramClient = JsonConvert.DeserializeObject <TelegramClient>(File.ReadAllText("telegram.json"));

            telegramClient.PixivDownloader = downloader;
            telegramClient.Setup();

            DiscordClient discordClient = JsonConvert.DeserializeObject <DiscordClient>(File.ReadAllText("discord.json"));

            discordClient.PixivDownloader = downloader;
            discordClient.IRCClient       = ircClient;
            ircClient.DiscordClient       = discordClient;
            ircClient.Setup();
            ircClient.Connect();
            var ircRun = new Task(ircClient.Run);

            ircRun.Start();

            discordClient.Client.MessageReceived += async(msgArgs) => {
                if (msgArgs.Channel.Id == 337692280267997196 && msgArgs.Author.Id != discordClient.Client.CurrentUser.Id)
                {
                    foreach (var attach in msgArgs.Attachments)
                    {
                        await ircClient.SendAsync($"PRIVMSG #onioniichan :{attach.Url}");
                    }
                }
            };

            var discordRun = new Task(async() => await discordClient.Run());

            discordRun.Start();

            var telegramRun = new Task(async() => await telegramClient.Run());

            telegramRun.Start();

            var tasks = new List <Task>();

            tasks.Add(ircRun);
            tasks.Add(discordRun);
            tasks.Add(telegramRun);
            Task.WaitAll(tasks.ToArray());

            //try {
            //  telegramClient.CTS.Cancel();
            //}
            //catch (Exception ex) { }
        }
コード例 #7
0
ファイル: Form1.cs プロジェクト: JacobMisirian/JRCLib
        private void btnConnect_Click(object sender, EventArgs e)
        {
            client = new IRCClient(txtServer.Text, Convert.ToInt32(txtPort.Text), txtNickname.Text, txtChannel.Text, cbSsl.Checked, txtUsername.Text);
            if (!client.Connect())
            {
                MessageBox.Show("Failed to connect! Timed out!");
                return;
            }

            client.MessageRecieved += client_mesageRecieved;
            new Task(() => client.BeginListening()).Start();
            currentChannel = txtChannel.Text;
        }
コード例 #8
0
ファイル: YailSharpDemo.cs プロジェクト: AppleDash/YAILSharp
        public void Go()
        {
            _client = new IRCClient(_config);

            //_client.LineReceived += ClientOnLineReceived;
            _client.LineSent        += ClientOnLineSent;
            _client.MessageReceived += ClientOnMessageReceived;

            _client.Connect();

            _running = true;
            _channel = _config.Server.Channels[0];

            new Thread(() =>
            {
                while (_running)
                {
                    Console.Write("> ");
                    var input = Console.ReadLine();

                    if (string.IsNullOrEmpty(input))
                    {
                        continue;
                    }

                    if (input[0] == '/')
                    {
                        if (input.Length > 1)
                        {
                            var split = input.Split(" ", 2);
                            if (split.Length == 2 && split[0] == "/me")
                            {
                                this._client.SendLine($"PRIVMSG {_channel} {(char)1}ACTION {split[1]}{(char)1}");
                            }
                            else
                            {
                                this._client.SendLine(input.Substring(1));
                            }
                        }
                    }
                    else
                    {
                        this._client.SendLine($"PRIVMSG {_channel} :{input}");
                    }
                }
            }).Start();

            MainLoop();
        }
コード例 #9
0
        public static void Main()
        {
            var client = new IRCClient(new IRCConfiguration
            {
                Username = "******",
                Hostname = "irc.onlinegamesnet.net",
                Port     = 6667
            });

            client.Ready += Client_Ready;
            client.UnhandledDataReceived += ClientOnUnhandledDataReceived;

            client.Connect();

            Thread.Sleep(-1);
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: jefe323/Arke
        /*some random code I want to save for a bit...

         int count = Channels.TabCount;
         MessageBox.Show(count.ToString());
         Channels.TabPages.RemoveByKey("#jefe323");

         */
        public static void Connect(string uServer, int uPort, string uReal, string uNick, string uPassword, string uChannel)
        {
            server = uServer;
            port = uPort;
            realname = uReal;
            nick = uNick;
            password = uPassword;
            channel = uChannel;

            irc = new IRCClient(uNick, uNick, uReal);
            irc.AutoReconnect = true;

            irc.NumberMessageReceived += new IRCClient.NumberMessageReceivedHandler(irc_NumberMessageReceived);
            irc.ChannelMessage += new IRCClient.ChannelMessageHandler(irc_ChannelMessage);
            irc.ServerMessageReceived += new IRCClient.ServerMessageReceivedHandler(irc_ServerMessageReceived);

            irc.Connect(uServer, uPort);
            irc.JoinChannel(channel);
            instance.ChannelList.Nodes[0].Nodes[0].Text = channel;
            instance.DefaultChannel.Name = channel.ToString();
            instance.DefaultChannel.Text = channel.ToString();
        }
コード例 #11
0
 public void Connect()
 {
     _client            = new IRCClient(_ircHost, _ircPort, Settings.Username, Settings.OAuth, Settings.Channel.ToLower());
     _client.OnPrivMsg += _client_OnPrivMsg;
     _client.Connect();
 }