예제 #1
0
파일: Discord.cs 프로젝트: Alintya/PoeSuite
        public Discord(ulong appId = 550890770056347648)
        {
            var discordEvents = new DiscordRpc.EventHandlers();

            discordEvents.ReadyCallback        += () => Logger.Get.Success("Connected to Discord RPC pipe");
            discordEvents.ErrorCallback        += (errCode, msg) => Logger.Get.Error($"Discord error triggered '{errCode}' {msg}");
            discordEvents.DisconnectedCallback += (_, __) => Logger.Get.Info("Disconnected from Discord RPC pipe");

            _callbackRunner          = new Timer(2000);
            _callbackRunner.Elapsed += (x, y) => DiscordRpc.Discord_RunCallbacks();
            _callbackRunner.Start();

            DiscordRpc.Discord_Initialize(appId.ToString(), ref discordEvents, false, null);
        }