Пример #1
0
        public async Task UnmuteUserAsync(DiscordRequest request, Contexts contexts)
        {
            var requestParser = new MuteRequestParser(request, this._usersService, contexts);
            var userToUnmute  = requestParser.GetUser();

            await this._unmutingService.UnmuteNow(contexts, userToUnmute);
        }
Пример #2
0
        public async Task MuteUser(DiscordRequest request, Contexts contexts)
        {
            var requestParser = new MuteRequestParser(request, _usersService, contexts);
            var userToMute    = requestParser.GetUser();
            var muteEvent     = requestParser.GetMuteEvent(userToMute.Id, contexts, request);

            await _muteService.MuteUserOrOverwrite(contexts, muteEvent, userToMute);

            _muteService.UnmuteInFuture(contexts, muteEvent, userToMute);
        }
Пример #3
0
        public async Task UnmuteUserAsync(DiscordRequest request, Contexts contexts)
        {
            var requestParser = new MuteRequestParser(request, _usersService, contexts);
            var userToUnmute  = requestParser.GetUser();

            var wasMuted = await _muteService.UnmuteIfNeeded(contexts.Server, userToUnmute);

            if (wasMuted)
            {
                var messagesService = _messagesServiceFactory.Create(contexts);
                await messagesService.SendResponse(x => x.UnmutedUser(userToUnmute), contexts);

                await _directMessagesService.TrySendMessage(userToUnmute.Id, x => x.UnmutedUserForUser(userToUnmute, contexts.Server), contexts);
            }
        }
Пример #4
0
        public async Task MuteUser(DiscordRequest request, Contexts contexts)
        {
            var requestParser = new MuteRequestParser(request, this._usersService, contexts);
            var userToMute    = requestParser.GetUser();

            if (userToMute.Id == this._usersService.GetBot().Id)
            {
                throw new UserDidntMentionAnyUserException();
            }
            var muteEvent = requestParser.GetMuteEvent(userToMute.Id, contexts, request);

            await this._mutingService.MuteUserOrOverwrite(contexts, muteEvent, userToMute);

            this._unmutingService.UnmuteInFuture(contexts, muteEvent, userToMute);
        }