コード例 #1
0
ファイル: MuteUserController.cs プロジェクト: Zilib/Watchman
        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);
        }
コード例 #2
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);
        }