Ejemplo n.º 1
0
        public async Task EndAsync()
        {
            if (Context.IsPrivate)
            {
                await ReplyAsync("Cannot be used with DM.");

                return;
            }

            var user = Context.Message.Author as SocketGuildUser;

            if (user?.VoiceChannel == null)
            {
                await ReplyAsync($"{Context.User.Mention} Please join the voice chat on this server.");

                return;
            }

            // Search game
            if (_automuteService.VCLinkedGames.TryGetValue(user.VoiceChannel.Id, out var code))
            {
                _logger.LogDebug("found linked game");
                try
                {
                    _automuteService.DestroyMuteController(code, user);
                }
                catch (Exception e)
                {
                    _logger.LogError($"{e.GetType()} -- {e.Message}");
                    using (_logger.BeginScope("err"))
                    {
                        _logger.LogError(e.StackTrace);
                    }
                }
                return;
            }
            await ReplyAsync($":speaker: \"{user.VoiceChannel.Name}\" > There are no games to pair with.");
        }
Ejemplo n.º 2
0
 public void OnGameDestroyed(IGameDestroyedEvent e)
 {
     _automuteService.DestroyMuteController(e.Game.Code.Code);
     _automuteService.Games.Remove(e.Game.Code.Code);
 }