Exemplo n.º 1
0
        private void CompleteStartup()
        {
            AddonManager.Load();
            Exit += (_, __) => AddonManager.Shutdown();

#if DEBUG
            DebugHelpers.Add();
#endif
            _mixerWindow    = new WindowHolder(CreateMixerExperience);
            _settingsWindow = new WindowHolder(CreateSettingsExperience);

            _settings.FlyoutHotkeyTyped   += () => _flyoutViewModel.OpenFlyout(InputType.Keyboard);
            _settings.MixerHotkeyTyped    += () => _mixerWindow.OpenOrClose();
            _settings.SettingsHotkeyTyped += () => _settingsWindow.OpenOrBringToFront();
            _settings.RegisterHotkeys();

            _trayIcon.PrimaryInvoke   += (_, type) => _flyoutViewModel.OpenFlyout(type);
            _trayIcon.SecondaryInvoke += (_, __) => _trayIcon.ShowContextMenu(GetTrayContextMenuItems());
            _trayIcon.TertiaryInvoke  += (_, __) => _collectionViewModel.Default?.ToggleMute.Execute(null);
            _trayIcon.Scrolled        += (_, wheelDelta) => _collectionViewModel.Default?.IncrementVolume(Math.Sign(wheelDelta) * 2);
            _trayIcon.SetTooltip(_collectionViewModel.GetTrayToolTip());
            _trayIcon.IsVisible = true;

            DisplayFirstRunExperience();
        }
Exemplo n.º 2
0
Arquivo: Bot.cs Projeto: Drummss/Meru
        private async Task InitializeBot()
        {
            instance = this;

            Log.InitializeLogging(clientInformation);

            Log.Message(VersionText);

            Client = new DiscordShardedClient(new DiscordSocketConfig()
            {
                TotalShards       = clientInformation.ShardCount,
                LogLevel          = LogSeverity.Info,
                HandlerTimeout    = 10000,
                ConnectionTimeout = 300000,
            });

            LoadEvents();

            EventSystem.RegisterBot(this);

            Events.RegisterPrefixInstance(">").RegisterAsDefault();

            // fallback prefix
            Events.RegisterPrefixInstance("miki.", false);
            // debug prefix
            Events.RegisterPrefixInstance("fmiki.", false, true);

            Addons = new AddonManager();
            await Addons.Load(this);

            if (clientInformation.EventLoaderMethod != null)
            {
                await clientInformation.EventLoaderMethod(this);
            }

            //MessageReceived += async (m) => Log.Message("message received");

            foreach (DiscordSocketClient c in Client.Shards)
            {
                c.Ready += async() =>
                {
                    Log.Message($"shard {c.ShardId} ready!");
                    await c.SetGameAsync($"{c.ShardId}/{GetTotalShards()} | >help");
                };

                c.Connected += async() =>
                {
                    Log.Message($"{c.ShardId}| Connected!");
                    await Task.Delay(0);
                };

                c.Disconnected += async(e) =>
                {
                    Log.ErrorAt(c.ShardId + "| Disconnected", e.Message);
                    await Task.Delay(0);
                };
            }

            Client.Log += Client_Log;
        }
Exemplo n.º 3
0
        private void CompleteStartup()
        {
            AddonManager.Load();
            Exit += (_, __) => AddonManager.Shutdown();

            _trayIcon.IsVisible = true;
            DisplayFirstRunExperience();
        }
Exemplo n.º 4
0
Arquivo: Bot.cs Projeto: amishshah/IA
        private async Task InitializeBot()
        {
            instance = this;

            Log.InitializeLogging(clientInformation);

            Log.Message(VersionText);

            Client = new DiscordShardedClient(new DiscordSocketConfig()
            {
                TotalShards = clientInformation.ShardCount,
                LogLevel    = LogSeverity.Debug,
            });

            Events = new EventSystem(x =>
            {
                x.Name           = clientInformation.Name;
                x.Identifier     = clientInformation.Prefix;
                x.SqlInformation = clientInformation.sqlInformation;
            });

            Sql = new Sql(clientInformation.sqlInformation, clientInformation.Prefix);

            Addons = new AddonManager();
            await Addons.Load(this);

            if (clientInformation.EventLoaderMethod != null)
            {
                await clientInformation.EventLoaderMethod(this);
            }

            Application.ThreadException +=
                new ThreadExceptionEventHandler(Application_ThreadException);

            Client.MessageReceived += async(a) =>
            {
                Task.Run(() => Client_MessageReceived(a));
            };
            Client.JoinedGuild += Client_JoinedGuild;
            Client.LeftGuild   += Client_LeftGuild;
//            Client.UserUpdated += async (u1, u2) => { Log.Done($"UPDATED {u1.Username}"); };

            foreach (DiscordSocketClient c in Client.Shards)
            {
                c.Ready += async() =>
                {
                    Log.Message($"shard {c.ShardId} connected!");
                    await c.SetGameAsync($"{c.ShardId}/{GetTotalShards()} | >help");
                };
            }

            //           Client.Log += Client_Log;
        }