コード例 #1
0
        protected override void DoConnect()
        {
            socket           = new DiscordWebsocket();
            socket.Token     = Config.BotToken;
            socket.Status    = Config.Status;
            socket.GetStatus = GetStatusMessage;

            socket.OnReady         = HandleReadyEvent;
            socket.OnMessageCreate = HandleMessageEvent;
            socket.OnChannelCreate = HandleChannelEvent;
            socket.Connect();
        }
コード例 #2
0
        protected override void DoConnect()
        {
            socket           = new DiscordWebsocket();
            socket.Session   = session;
            socket.Token     = Config.BotToken;
            socket.Presence  = Config.PresenceEnabled;
            socket.Status    = Config.Status;
            socket.Activity  = Config.Activity;
            socket.GetStatus = GetStatusMessage;

            socket.OnReady         = HandleReadyEvent;
            socket.OnResumed       = HandleResumedEvent;
            socket.OnMessageCreate = HandleMessageEvent;
            socket.OnChannelCreate = HandleChannelEvent;
            socket.Connect();
        }
コード例 #3
0
        void IOThread()
        {
            try {
                socket.Connect();
                socket.ReadLoop();
            } catch (Exception ex) {
                Logger.LogError("Discord relay error", ex);
                if (disconnecting)
                {
                    return;
                }

                // try to recover from dropped connection
                TryReconnect();
            }
        }